Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Eric den Doop
  Where is Eric den Doop?
 Houten
 Netherlands
 Eric den Doop
 To: emily
  Where is emily?
 ST
 Philippines
 emily
 Tags
Subject: RE: migrate/print formatted text in word
Thread ID: 415 Message ID: 417 # Views: 5 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Tuesday, May 29, 2001 12:30:25 AM         
   


> i have a select statement and stores the query result in a cursor. the fields include both unformatted and formatted ( i.e. italicised, underlined, etc) text. text is formatted using an rtf control and this formatted text is stored in a memo field. the records in the cursor are programatically dumped to a word document
>
> problem is how do i migrate/print the formatted text in word?
> i'm using this code:
>
> SCAN
> AddParagraph(toWord, ALLTRIM(Field1)) && normal text
> AddParagraph(toWord, ALLTRIM(Field2)) && displays text and format codes
> ....
> ENDSCAN
>
> emily.d

Hi Emily,

Good to see you here. Hope all is well. I have tried such things a dozen times without any luck: Word constantly displayed the RTF codes instead of the formatted text. Until... one of my customers found a solution.

SCAN
* do your usual stuff
* save your rtf memo field to a file
STRTOFILE(yourmemo, "c:\temp\richtext.rtf")
ENDSCAN

In your word document template file, you must use an internal Word field: \Insert\Field and then select Links and references in the left listbox (Categories). From the right listbox (Field names), choose IncludeText. Make sure it looks like this in your word document:

[INCLUDETEXT "c:\\temp\\richtext.rtf" \* MERGEFORMAT]

You probably have to execute the Word mail merge commands:

loWord.ActiveDocument.MailMerge.Execute
lnDestination = 1
DO CASE
CASE lnDestination = 1
.ActiveDocument.PrintOut &&print word doc
CASE lnDestination = 2
.ActiveDocument.SendMail &&send as email
CASE lnDestination = 3
.SendFax &&send to fax device
ENDCASE

Hth
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts

ENTIRE THREAD

migrate/print formatted text in word Posted by emily d @ 5/28/2001 9:49:05 PM
RE: migrate/print formatted text in word Posted by Eric den Doop @ 5/29/2001 12:30:25 AM
RE: migrate/print formatted text in word Posted by emily d @ 5/30/2001 7:16:50 PM
RE: migrate/print formatted text in word Posted by Eric den Doop @ 5/31/2001 1:42:51 AM