Free Support Forum -

Best Practice for maintaining Formatting with document as template

I am evaluating Aspose Word as a possible solution for a document merge process in which a Word document is essentially a template into which I intent to insert an 'addendum' as well as filling some merge fields from an SQL database. In the near future I may also insert some blocks of text conditionally based on a data value. I've managed to accomplish each of the pieces of the process including exporting to PDF... with the only caveat being final document formating.

It seems probable to me that I should NOT have created a new document object into which I inserted the 'template' as a first step. Mostly, I'd like to know what the recommended order of action is.

Also I'd like to understand how to control the formating of sections added later (like the Addendum).

If you'd prefer e-mail to Forum, please feel free to reply to the registered address.



Hi Geoffrey,

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

Thank you for your interest in Aspose.Words. No, you should not insert your template into another empty document. As the first step you should open your template:

Document doc = new Document(@"Template.doc");

Then you can perform mail merge, if it is necessary, or append another documents to this template:

Then you just save the output document in desired format.

Please feel free to ask if you need more assistance, I will be glad to help. If you need a code example, you can share your templates and show me what the expected output is, and I will try to show a correct way to achieve what you need.

Best regards.