Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Moving RTF text to Word document
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00584887
Message ID:
00584913
Vues:
37
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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform