Free Support Forum - aspose.com

Repeating word template for multiple users with mergefields

Hi
I have a word template. I want to repeat this template for multiple users from database. the result should be like
User1Template
User2Template
.
.
.
User50Template.
Please help on this…

@ssponnada

Thanks for your inquiry. Please ZIP and attach your input and expected output Word documents here for our reference. We will then provide you more information about your query along with code.

Hi
Thanks for your reply. I have used below lines for merging documents. It is working fine for some users and getting “Too many styles in the document” error.
sdoc.AppendDocument(dstDoc, ImportFormatMode.KeepSourceFormatting)
sdoc.Save(dataDir + “Document.AppendDocument Out.doc”)

@ssponnada

Thanks for your inquiry. Please use Document.Cleanup method (CleanupOptions) to remove all unused styles from the documents. Hope this helps you.

If you still face problem, please attach the following resources here for testing:

  • Your input Word documents.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.