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

Can't save merge fields in docx

1 Answer 62 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Kenneth
Top achievements
Rank 2
Iron
Kenneth asked on 13 Aug 2014, 09:14 AM
I'm using the github richtextbox texteditor project example.

When I add a mergefiled via the UI then save as docx the resulting document has the merged data from the first record in the mergedatasource, not the merge field.

Per the documentation, docx and xaml should presist the merge fields.

Saving as xaml works fine, the merge fields are persisted,

I would like to be able to save as a docx with the merge fields in the document.

SL5
VS2010
VB.NET

1 Answer, 1 is accepted

Sort by
0
Accepted
Mihail
Telerik team
answered on 18 Aug 2014, 08:04 AM
Hello Kenneth,

  Actually the merge field is there. What you see is the result mode of the field.
You could change the field display mode, in RadRichTextBox and MS Word, by clicking with the mouse right button on the field and pressing the "Toggle Field Codes" option in the context menu.

In case you need to preserve the fields in DisplayName mode you could do it by using the DocxExportSettings.FieldResultMode. Here is example on how to do it:
DocxFormatProvider formatProvider = new DocxFormatProvider();
formatProvider.ExportSettings.FieldResultMode = FieldDisplayMode.DisplayName;

Here is a link to useful help article about the Import/Export settings. And here is another article you may find useful as well about Mail Merge.

I hope this information answers your questions.

Regards,
Mihail
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
RichTextBox
Asked by
Kenneth
Top achievements
Rank 2
Iron
Answers by
Mihail
Telerik team
Share this question
or