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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Long Word Document from VFP with data field.

Status
Not open for further replies.
Welcome to the forum, Sansanto.

For creating a report as a Word document, you have two broad choices:

1. Use Office Automation. If you have not used Automation before, it will involve learning quite a lot of new information - more than I can explain in a forum post. On the other hand, it is a very flexible solution, giving you a lot of control over the format and content of your reports. Note that it requires the end user to have Microsoft Word installed.

A good place to start learning about Automation with Microsoft Word is Tamar Granor's articles and conference papers. Start here:

2. Create the report as usual in VFP, and use a third-party tool to convert it to Word. There are several such tools available, but the one that many of here use is FoxyPreviewer (see Essentially, it replaces VFP's build-in report preview tool, and has the added ability to save the report to a PDF or a Word document (actually, it saves to RTF rather than Word, but Word can open and read RTF documents without any special user involvement). FoxyPrviewer is easy to integrate into your application, and is free.

I hope this will get you started.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Sansanto,

You also may want to have a look at the MailMerge function in MS-Word. In short, it allows you to type/format your text in MS-Word and then insert the variable data from your tables/cursors.

hth

MarK
 
Thanks Mike i will learn office automation would you please so me an example please, but when i used built in report vfp so difficult to me. because the report over one page.
Hi mjcmkrsr first i must create mailmerge in word than send variable from vfp, i will try it thanks for suggestion.
 
I can't give you an example of Office Automation. It's a big subject and too complicated to summarise in an example. In any case, there's no point in you having an example until you understand the concepts.

I suggest you spend some time with the conference paper that I linked to in my first post, above.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi

Hi mjcmkrsr first i must create mailmerge in word than send variable from vfp, i will try it thanks for suggestion.

The easiest way is to have your data ready e.g.

USE tblYourTable
COPY TO csvData TYPE CSV

Then from MS-Word, while being in your document click: Mailings - Select Recipients - Use an Existing List - Choose you file, e.g. csvData.CSV. You may then Insert Merge Field wherever you want.

hth

MarK

 
HOW_BOLD_zzz7ge.jpg


Mycode :
oRange.Collapse( wdCollapseEnd )
oRange.End = oRange.End + 1 && to allow assignment to font
oRange.Style = oMinorHeadingStyle
oRange.InsertAfter("PASAL 5" + CR)
oRange.InsertAfter("SANKSI-SANKSI" + CR)
oRange.Collapse( wdCollapseEnd )
oRange.End = oRange.End + 1 && to allow assignment to font
oRange.Style = oBodyStyle
oRange.InsertAfter("1. Apabila pada waktu perjanjian ini berakhir, PIHAK PERTAMA belum mampu membayar uang gadai beserta bunga, maka PIHAK KEDUA akan mengadakan lelang untuk kendaraan yang digadaikan oleh PIHAK PERTAMA, tanpa meminta persetujuan dari PIHAK "+CR)
oRange.InsertAfter("PERTAMA, dan PIHAK PERTAMA tidak berhak untuk mengajukan tuntutan apa pun kepada PIHAK KEDUA."+CR)
oRange.InsertAfter("2. Hasil penjualan atas kendaraan tersebut menjadi hak PIHAK PERTAMA setelah dikurangi utang pokok PIHAK KEDUA ditambah"+CR)
oRange.InsertAfter("bunga dan denda."+CR)

How to make Bold Font like picture, Please anyone help me, Thanks.
 
For that big block of text, you'll have to insert it a little at a time. You can bold any range before you collapse by issuing:

oRange.Font.Bold = .T.

Tamar
 
Hi all
i was try make justify alignment in word automation but fail the text not justify alignment,
can anyone help me please
Code:
oRange.Collapse( wdCollapseEnd )
oRange.End = oRange.End + 1 && to allow assignment to font
oRange.Style = oMinorHeadingStyle
oRange.InsertAfter("PASAL 1" + CR)
oRange.InsertAfter("PENGAJUAN KREDIT" + CR)
oRange.Collapse( wdCollapseEnd )
oRange.End = oRange.End + 1 && to allow assignment to font
oRange.Style = oBodyStyle
[b]oRange.ParagraphFormat.Alignment = wdAlignParagraphJustify[/b]
oRange.InsertAfter("Meminta kepada "+VCP+" selaku Showroom untuk mengajukan proses pembiayaan ke Leasing/Bank Lembaga Pembiayaan yang menjadi Rekanan "+VCP+" dengan tidak terbatas pada lembaga pembiayaan yang ada; dan akan ada dikemudian hari."+CR)
oRange.InsertAfter("Bahwa dalam pengajuan pembiayaan ini saya telah mendapat persetujuan penjamin (Suami atau Istri atau Orang tua) termasuk"+CR)
oRange.InsertAfter("Pihak terkait lainnya dan apabila timbul permasalahan yang menyangkut tentang status penjamin (Suami atau Istri atau "+CR)
oRange.InsertAfter("Orang tua atau pemilik terkait lainnya) terhadap penyalahgunaan kartu tanda penduduk, tanda tangan atau semua informasi"+CR)
oRange.InsertAfter("yang menyesatkan maka hal tersebut menjadi tanggung jawab saya sepenuhnya;"+CR)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top