I wish as U some questions on trichedit class only 8 small question ...
because I need it for a application and I compiled the testrtf,prg to see what I have and I rewrite a small rtfpad (from testrtf.prg)
I add a second bar down the first and not when I open a file rtf ( as testrtf.prg)
1. question
on testrtf.prg there is a save function
- Code: Select all Expand view
- static function Save()
local cFile := cGetFile( "Rich Text Format (*.rtf) |*.rtf|" + ;
"Only Text Format (*.txt) |*.txt", ;
"Please write a filename", nGetFileFilter(),, .t. )
if !Empty( cFile )
cFile := Upper( cFile ) + If( ! "." $ cFile, If( nGetFileFilter() == 1, ".RTF", ".TXT" ), "" )
oRTF:SaveToRTFFile( cFile )
oRTF:SetClear()
endif
return nil
the file can be txt or rtf
cFile := Upper( cFile ) + If( ! "." $ cFile, If( nGetFileFilter() == 1, ".RTF", ".TXT" ), "" )
but on tichedit class I not found the possibility to set the format of the file
on include there are also
#define SF_TEXT 1
#define SF_RTF 2
but I not found any sample on testrtf to use or save a rtf file into txt
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2 Question
I wish create a lines as this picture
and on testrtf.rtf I found also there is the possibility to insert also Hyperlink but I not found the methods on trichedit class
I thinked to create these new methods
seeing the METHOD SetAttribute on trichedit class
- Code: Select all Expand view
METHOD SetAttribute2( lUpp, lSup, lSub, lOnOff )
METHOD SetUpperCaps( lOnOff ) INLINE ::SetAttribute2( .T.,,,,, lOnOff )
METHOD SetSupScript( lOnOff ) INLINE ::SetAttribute2( , .T.,,,, lOnOff )
METHOD SetSubScript( lOnOff ) INLINE ::SetAttribute2( ,, .T.,,, lOnOff )
METHOD SetHiddenTxt( lOnOff ) INLINE ::SetAttribute2( ,,, .T.,, lOnOff )
METHOD SetHyperLink( lOnOff ) INLINE ::SetAttribute2( ,,,, .T., lOnOff )
METHOD SetAttribute2( lUpper, lSuper, lSub, lHidden, lLink, lOnOff ) CLASS TRichEdit
LOCAL nMask, nEffects
DEFAULT lUpper := .F., ;
lSuper := .F., ;
lSub := .F., ;
lHidden := .F., ;
lLink := .F., ;
lOnOff := .T.
if ( lUpper .or. lHidden ) .and. ! ::lRE30
RETURN NIL
endif
nMask := nOr( If( lUpper, CFM_ALLCAPS, 0 ), ;
If( lSuper, CFM_SUPERSCRIPT, 0 ), If( lSub, CFM_SUBSCRIPT, 0 ), ;
If( lHidden, CFM_HIDDEN, 0 ), If( lLink, CFM_LINK, 0 ) )
nEffects := nOr( If( lUpper, CFE_ALLCAPS, 0 ), ;
If( lSuper, CFE_SUPERSCRIPT, 0 ), If( lSub, CFE_SUBSCRIPT, 0 ), ;
If( lHidden, CFE_HIDDEN, 0 ), If( lLink, CFE_LINK, 0 ) )
RESetAttribute2( ::hWnd, nMask, nEffects, lOnOff )
RETURN NIL
then I not found RESetAttribute( ::hWnd, nMask, nEffects, lOnOff ) to make RESetAttribute2( ::hWnd, nMask, nEffects, lOnOff )
perhaps Antonio can Help us
---------------------------------------------------------------------------------------------------------------------------------------------
3 Question
I wish set the paragraph of the text but I not found a sample into testrtf.prg
but I found some methods :
aIndent := ortf:GetIndent() give me the left , right and first line ( izquierda,derecha,primeralinea)
ortf:GetParagraph() give me two parametes before and after
ortf:GetAlign() give me the type of align
On winword I have this dialog
then I thinked to create this dialog
with ortf:GetParagraph() I have two parameters but I need the spaces I found (tab spaces) how I can make ?
---------------------------------------------------------------------------------------------------------------------------------------------
4 Question
I found on testrtf.prg the find function
ok . I can find a word but...
how I can replace a word with another ?
and if I must replace all same words with another ?
wich is the method make it ?
I need it also to make a procedure of merge with fields from a dbf
---------------------------------------------------------------------------------------------------------------------------------------------
5 Question
I can change the color of the text with ortf:SetTextColor( ChooseColor( ncolor ) )
but I not have the ncolor current of the text how I can found it ?
---------------------------------------------------------------------------------------------------------------------------------------------
6 Question
When I open a rtf file ( as you can see on first picture of this message ) I see the file into the window main
but how I can show the file as our rpreview ( type printer layout ) as we see it on winword or wordpad application ?
---------------------------------------------------------------------------------------------------------------------------------------------
7 Question
I remember there was a function called SHFileProperty() and I found also a sample on .\samples of fwh
I need it to show the property of the file from rtfpad , why this function there was not on new fwh release ?
---------------------------------------------------------------------------------------------------------------------------------------------
8 Question
How I can insert object into rtfile sample I need to insert tables or excel or another object from a extern application ?
thanks