Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Moving RTF text to Word document
Message
 
To
22/11/2001 08:44:44
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00584887
Message ID:
00584913
Views:
36
Hi,
You can make it using clipboard and API functions:
#define GMEM_MOVEABLE 2
#define GMEM_ZEROINIT 64

Declare Long GlobalAlloc in Win32API Long uFlags, Long dwBytes
Declare Long GlobalFree in Win32API Long hMem
Declare Long GlobalLock in Win32API Long hMem
Declare Long GlobalUnlock in Win32API Long hMem
Declare String lstrcpy in Win32API Long lpDest, String @ lpStr
Declare Long OpenClipboard in Win32API Long
Declare Long CloseClipboard in Win32API
Declare Long EmptyClipboard in Win32API
Declare Long RegisterClipboardFormat in Win32API String
Declare Long SetClipboardData in Win32API Long uFormat, Long hMem

strRTF = Mytable.RTFField
If(OpenClipboard(0) != 0)
    h = GlobalAlloc(GMEM_MOVEABLE+GMEM_ZEROINIT, LEN(s)+1)
    ptr = GlobalLock(h)
    lstrcpy(ptr, strRTF)
    EmptyClipboard()
    cf = RegisterClipboardFormat("Rich Text Format")
    SetClipBoardData(cf, h)
    CloseClipboard()
    GlobalUnlock(h)
    GlobalFree(h)
    oWord.Selection.Paste
EndIf
>Hello,
>I have memo fields that store text in RTF format. This text is being displayed and edited in the program using an RTF control.
>
>I want to create a word document and adding the memo content also to the Word document, but retaining the styles of the RTF text.
>How can this be done?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform