Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Paste RTF into Word from a field
Message
From
19/12/1999 09:41:43
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00305791
Message ID:
00305856
Views:
34
>I have RTF text (like: {\rtf1\ansi\ansicpg1252\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}...) in a field. I am trying to write automation code to paste that text into Word as formatted text.
>
>I can get the text, unformatted, to paste and I can get the RTF code itself (like above) to paste, but not the formatted text that the code represents. If I try using the clipboard, it seems like the clipboard does not recognize that the text is RTF code - so I do not get the Paste Special option for "Formatted Text (RTF)" in Word as I would if I just did Ctrl-C in the RTF ActiveX control. Using .TextRange.PasteSpecial(,,,,wdPasteRTF) returns an error.


Roger,
If you do it via clipboard word would get as a plain text. Instead temporarily write it to a file and open the file in word :
lcRTF = mytable.myfield
lcFiel = "c:\mypath\myrtf.rtf"
handle=fcreate(lcFile)
=fwrite(handle,lcRTF,len(lcRTF))
=fclose(handle)
oWord = createobject("Word.Application")
with oWord
 .Documents.Open(lcFile)
endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform