Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export data from VFP9 to Word document with detail section

Status
Not open for further replies.

Eliott

Programmer
Nov 8, 2009
91
BA
I know basic idea how an ordinary record of VFP tabel rather than in the report to switch to Word document: first I exported the table to Excel file, then create a Word document with necessary descriptive text, and then by using Mailmerge toolbar I select source and set the fields in place. When I start this document it run fine but ... The problem is that I do not know how to simulate the VFP Report Detail section in this way, because it always prints only one record on each particular page (document), and I'd like to create a Word document that has a header, title, and detail section with all the records that are within that table. Is it possible to perform on this way? Thank you.

There is no good nor evil, just decisions and consequences.
 
I would do this with OLE automation.

That way you get complete control of the out put.

Search for this in google
Code:
VFP 'Word = CreateObject("Word.Application")'

Then come back here with any specific questions.

Remember recording and looking at VBA macros is the best way to learn how to do it.

Good luck

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
If you rather want the output of an frx to a doc, use FRX2Any, which enables to print an frx to a doc file besides other formats.

A strategy I rather use when creating Word docs is having a template which VFP then loads and adds data to it. You rather loop through the data in VFP and push it into the word doc than defining a datasource in Word to pull in the data from word, VFP is the much better tool to do the data preprocessing and automation of the word doc, as you have both the capabilities and language of VFP and the VBA Basic commands and objects via the OLE automation object.

Bye, Olaf.

 
I did it "by bare hands". Code is too big to show here but functional. Some data from form's fields I transferred into variables and then I filled up Word's document (no Merge option). Detail section I solved by using classic For...Next cycle and by reading row by row and nailed into table. A little problems were with shading and justification but I did it again after hours of try-error technique. It's not fast as frx-way but it works. I didn't check it as EXE, compiled yet, and I'm not sure what else I shall to add into Inno config beside classic VFP needs, but I hope it will works well.
This hard coding way is slow, murky, but when there is no better (or free) way, then it does pay.
Sorry Olaf, I can't afford Frx2any, and was unable to get demo. Thanks.

There is no good nor evil, just decisions and consequences.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top