Free Support Forum - aspose.com

Create a document based on a template

Hi,

I want to create a word document based on a template doc using aspose.words.

How can I create that if anybody can help me out.

The template doc is attached herewidth.


Suchira

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I think, the best way to achieve this is using Mail Merge feature. Please see the following link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/simple-mail-merge-explained.html

Also, see the following link to learn how to prepare template:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/prepare-a-document.html

Best regards,

Hi,

I have looked in the links.

My requirement is I need to store data from xml into the merge fields of the template doc at runtime.

How can i do that in Java.

I have looked into examples where methods are given in .Net but couldnt find anything in Java.


Suchira

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. You can use IMailMergeDatasourse in this case. Please see the following link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/com/aspose/words/imailmergedatasource.html

In java, you can read XML, for example like described here:

http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html

Hope this helps.

Best regards.

Hi,

Thanks I have been able to store data from xml into the mail merge fields of word doc .

Regards

Suchira