Can't save merge fields in docx

2 posts, 1 answers
  1. Kenneth
    Kenneth avatar
    104 posts
    Member since:
    Apr 2014

    Posted 13 Aug 2014 Link to this post

    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.

  2. Answer
    Mihail avatar
    268 posts

    Posted 18 Aug 2014 Link to this post

    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.

    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.
Back to Top