This is a migrated thread and some comments may be shown as answers.

replace Word merge field or text with WordsProcessing merge field

1 Answer 136 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
Eli
Top achievements
Rank 1
Veteran
Eli asked on 13 Feb 2018, 04:02 PM

Is there a way to take an existing Word document that is full of Word merge fields and replace them with merge fields that Telerik Document Processing understands («Zipcode» to MERGEFIELD Zipcode)?

I understand how I can create merge fields in code, but there are many templates with all sorts of formats and I would prefer to not have to recreate each one in code.  As a second option is there a way to do a replace text with a MERGEFIELD?  That would at least allow me to minimally modify the Word document. 

These Word templates will continue to be used outside of the web and ideally I would want a user to be able to select a template (.docx) to load with allowable merge fields, and then I take care of merging them via document processing and return the nicely merged document based on the data in our application.

I do not see how I can easily just translate between the two.

1 Answer, 1 is accepted

Sort by
0
Accepted
Tanya
Telerik team
answered on 15 Feb 2018, 10:57 AM
Hello Eli,

The MERGEFIELD elements defined in MS Word are supported in RadWordsProcessing and are automatically imported. Thus, you won't need to replace them with other elements or modify the template in any way. All you will need to do to perform a Mail Merge is to import the template, invoke the MailMerge() method of RadFlowDocument passing the collection with the values to it and then save the result from this method using one of the available format providers.

I am also attaching a simple demo project demonstrating the functionality. 

Hope this information is helpful.

Regards,
Tanya
Progress Telerik

Tags
WordsProcessing
Asked by
Eli
Top achievements
Rank 1
Veteran
Answers by
Tanya
Telerik team
Share this question
or