Hi Marco;
I **think** if it can be done with rich text, then it can also be done with TRichEdit class. You may have to write some wrapper funcs for some richtext functions that did not make it to richedit.prg, but it should work. In other words, if it is rich text, then all you need should be in RichEd20.dll.
If you search for and read about charformat and charformat2 richtxt structures you may find that these two c structures can be manipulated to do just about anything.
Here is an example showing the wrapper function to highlight text:
- Code: Select all Expand view
//----------------------------------------------------------------------------//
HB_FUNC( RESETHIGHLIGHT )
{
CHARFORMAT2 cf;
memset( &cf, 0, sizeof( cf ) );
cf.cbSize = sizeof( cf );
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = hb_parnl( 2 );
hb_retl( SendMessage( ( HWND ) hb_parnl( 1 ), EM_SETCHARFORMAT,
SCF_WORD | SCF_SELECTION, ( LPARAM ) &cf ) );
}
And here is how it is being called from your app:
- Code: Select all Expand view
//------------------------------------------------------------------------------------------------------------------------------
METHOD RTFHighlight() CLASS PATHTRANS
LOCAL nClrHigh := ReGetHighlight( ::oActive:hWnd )
LOCAL nClrBack := ChooseColor( nClrHigh )
if !( nClrHigh == nClrBack )
ReSetHighLight( ::oActive:hWnd, nClrBack )
::oActive:lChanged := .T.
endif
RETURN NIL
It has been a while since I worked with rich text and when I did, I also had to write a few wrapper functions. Now I don't remember which wrapper functions I wrote and which I got from other people. I have quite a collection. Back then I remember having read a lot about the 2 c structures that hold text and paragraph attributes. At the end I found that it worked better for me when I had complete control over the rtf from my own fwh app. I never manipulated tables, but I still think that if it can be done with richtext, then it should be on RichEd20.dll.
Hope that helps,
Reinaldo.