Mail merge

1 Answer 31 Views
General Discussions
Eric
Top achievements
Rank 1
Iron
Iron
Iron
Eric asked on 25 May 2022, 11:05 AM

Hi

Is there any RTF like editor which we can use to create a RTF file with Mail  merge field which we can use to create a template that can be used to generare DOCX or PDF files?

Eric

 

PS The Editor is missing in the list of Tags

 

 

1 Answer, 1 is accepted

Sort by
0
Hristian Stefanov
Telerik team
answered on 30 May 2022, 08:38 AM

Hi Eric,

The desired result seems possible currently with our Editor.

The idea is to use a combination between the Editor and the RadFlowDocument from the WordsProcessing.

The Editor allows you to convert and export its HTML into plain text, pdf, etc. We have a knowledge base article that shows the Editor exporting its HTML: Convert Editor Value to Plain Text. Use the example from the knowledge base article and replace the plain text exportation with PDF/DOCX. The exportation happens through the RadFlowDocument. Here is an example of RadFlowDocument exporting to PDF and DOCX:

Lastly, here is the article for Mail Merge functionality that WordsProcessing also provides: Mail Merge.

I hope this helps. If further concerns appear, I would be glad to help.

Regards,
Hristian Stefanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Eric
Top achievements
Rank 1
Iron
Iron
Iron
commented on 30 May 2022, 08:49 AM

Hi

 

What if I let the user crate a Word document with merge fields off line,  he or she uploads the document and I would only like to mail merge it with a dataset.

 

is this possible?

 

Eric

Dimitar
Telerik team
commented on 02 Jun 2022, 06:05 AM

Hi Eric,

Yes, this is possible, after the document is uploaded you will need to perform 3 steps:

  1. Import the document with the DocxFormatProviderwhich will return a RadFlowDocument instance.
  2. Perform the mail merge.
  3. Export the result document with the provider.

Here is an example of this:

 DocxFormatProvider provider = new DocxFormatProvider();
 RadFlowDocument document = provider.Import(File.ReadAllBytes(@"..\..\sampleDoc"));

 RadFlowDocument mailMergeResult = document.MailMerge(mailMergeDataSource);

 File.WriteAllBytes(@"..\..\result.docx", provider.Export(mailMergeResult));

Let me know if I can assist you further.

Eric
Top achievements
Rank 1
Iron
Iron
Iron
commented on 02 Jun 2022, 07:46 AM

Thanks!
Tags
General Discussions
Asked by
Eric
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Hristian Stefanov
Telerik team
Share this question
or