Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Quick Transfer of Losts of VFP Data to Word Table?
Message
From
12/10/2001 23:32:25
Isabel Cabanne
Hubbard Woods Software, Inc.
Winnetka, Illinois, United States
 
 
To
12/10/2001 21:26:06
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00567281
Message ID:
00568095
Views:
23
>>I started working with COPY TO, and the issue of getting data in with no character field delimiters (even spaces won't work for me), but soon realized I have a bigger issue. In many reports, I embed returns in the strings to format the data within an individual cell. For example: a formatted address designed for use in a mail merge. You can imaging the havoc that Word's Text to Table conversion works on that data.
>
>You can convert CRs into "^R" or whatever is word's internal denoting a CR, using StrTran(), before copying out.
>
>>I am going to try passing the data through HTML. I wonder, however: can I push a table onto the clipboard and paste it in somehow? Or, perhaps there's a row by row approach that's faster than a cell by cell population of the table.
>>
>>In any event, I need a VFP 6 resolution for the time being.
>
>Another approach: select the data you need into a cursor. Then get all of it onto the clipboard:
>_vfp.datatoclip(,,3)
>Then paste it in Word. This gives you a tab-delimited set of values, with cr/lf between records, which Word can automatically convert into a table. As far as conversion of CRs goes, I figure ^R would confuse Word, but it can be manipulated once you have a table - a search/replace within Word can do that. Just use something like "%%" instead.

Thanks. I'll look at _vfp.datatoclip().

For the imbedded line feeds, I'm not sure I want to replace them with something else, as one result set is used to populate a grid in the application as well as the report sent to Word, and I have a lot of reports. If I have to, however, I could adjust to that.

My bigger problem comes with Word. I'm finding that when I try to run a search & replace, Word won't do it properly unless I make the application object visible. I've tried selecting the range top-down, bottom-up, and in several variations, as well as variations on executing the replace. No luck. The only thing I haven't done yet is try the replace after populating the table. I'm using VFP 6 and need to be compatible back to Word version 8. In fact, I'm finding there are a number of quirky things that happen (more precisely don't happen) when the Word app is not yet visible. Any thoughts on that one?

Thanks,
Isabel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform