Alaska Software Inc. - How to fill a template file in word 07
Username: Password:
AuthorTopic: How to fill a template file in word 07
JAYARAM MYSOREHow to fill a template file in word 07
on Thu, 30 Jul 2009 08:26:35 +0530
I have created a template file. How do I fill this template file from my 
application and create a .doc file and print ?
IBARe: How to fill a template file in word 07
on Sun, 02 Aug 2009 02:28:23 -0700
Three steps:

1. Create a file with the data you wish to merge (a DBF is ok, but if you 
want to deploy your application elsewhere, I suggest a text file).

2. Create a document with inserted fields.

3. Execute the merge via activeX:



oWord := CreateObject("Word.Application")

IF Empty( oWord )

  MsgBox( "Microsoft Word is not installed!" )

  Return Nil

ENDIF

oWord:visible := .F.



 Open a Word document

oMyDoc := oWord:documents:open( cWordFile )

oMyDoc := oWord:ActiveDocument



oMyDoc:MailMerge:OpenDataSource(cMyData, .F., .F., .T., .F. )

oMyDoc:MailMerge:Execute(.T.)

oMyDoc:Close(.F.)



-Itai
mark carew Re: How to fill a template file in word 07
on Mon, 03 Aug 2009 18:14:33 +1000
On Thu, 30 Jul 2009 08:26:35 +0530, JAYARAM MYSORE wrote:

> I have created a template file. How do I fill this template file from my 
> application and create a .doc file and print ?

Have a look at wordprocessingml in documentformat.openxml. It creates .docx
word documents. They are typically 1/3 the size of the previous legacy .doc
files.