We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to merge several times

Hi,
our need is to build a template doc with merge fields and to be able to update the value of these fields several times.
For example we get a template document with a merge field named “version_number”.
At a first time we merge the template to generate a .docx with “1” as value for version_number, then we modify the .docx by adding a new chapter … and then we want to merge again this modified docx with 2 as value for version_number.
that means to keep the merge informations in the docx to be able to merge it several times …
Is it possible ?
Thanks in advance for your help

@tparassin

Thanks for your inquiry. Unfortunately, your question is not clear enough therefore we request you to please elaborate your inquiry further. Also, please supply input/output documents and your current code for testing. This will help us to understand your scenario, and we will be in a better position to address your concerns accordingly.

Hi,
i don’t get any code for the moment.

Our need is to do mail merge as described in

@tparassin

Thanks for your inquiry. We suggest you please read the following articles about mail merge.
About Mail Merge
How to Execute Mail Merge

Please share your input and expected output Word documents here for our reference. We will then provide you code example according to your requirement.

PS : Please create your expected output document using MS Word.

in other words, our need is to use named fields that the user can insert in the document.
Then we affect a value to theses fields by an Aspose.words program, which can be run several times to update the values.
What is the best solution ?

@tparassin

Thanks for your inquiry. Please note that Aspose.Words for .NET is a class library that enables your applications to perform a great range of document processing tasks. Aspose.Words does not provide any UI to insert the mail merge field. However, you can programmatically insert the mail merge field using Aspose.Words. Please check the following code example.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertField(@"MERGEFIELD MyMergeField1 \* MERGEFORMAT");
builder.InsertField(@"MERGEFIELD MyMergeField2 \* MERGEFORMAT");

How you want to insert the mail merge into document? Please share the complete detail of your use case. We will then answer your query accordingly.

i think we are going to use the structured document tags to create templates and to populate them with values.

is it possible to use structured document tag in wordarts ?

@tparassin

Thanks for your inquiry. Yes, you can insert the content control into template document and populate them with values. Please read the following article.
Working with Content Control SDT