Help - RTF Filter (all but text)
Help - RTF Filter (all but text)
I need to be able to filter everything in an RTF file but the text, but im not too sure where to start, has anyone got any documentation on this file and/or a way i could use to filter it?
A real dirty way is to load the .rtf content into an editor gadget and then use GetGadgetText() to pull out just the text etc.
PB 3.94.
PB 3.94.
Code: Select all
If OpenWindow(0,0,0,322,150,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"EditorGadget") And CreateGadgetList(WindowID(0))
EditorGadget(0,8,8,306,133)
a$="{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fswiss\fcharset0 Arial;}}"
a$+"{\colortbl ;\red255\green0\blue0;}{\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\f0\fs20 Hello \cf1\fs32 TESTING\cf0\f1\fs20\par}"
SetGadgetText(0, a$)
;Now get just the text.
b$=GetGadgetText(0)
Debug b$
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
I may look like a mule, but I'm not a complete ass.
srod wrote:A real dirty way is to load the .rtf content into an editor gadget and then use GetGadgetText() to pull out just the text etc.
PB 3.94.
Code: Select all
If OpenWindow(0,0,0,322,150,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"EditorGadget") And CreateGadgetList(WindowID(0)) EditorGadget(0,8,8,306,133) a$="{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fswiss\fcharset0 Arial;}}" a$+"{\colortbl ;\red255\green0\blue0;}{\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\f0\fs20 Hello \cf1\fs32 TESTING\cf0\f1\fs20\par}" SetGadgetText(0, a$) ;Now get just the text. b$=GetGadgetText(0) Debug b$ Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow EndIf
Haha thats excellent, i was looking more for a way of decoding, but hey, if the design plans are there, why not use them? thanks.