RichTextBox MailMerge changes

3 posts, 1 answers
  1. Clifford
    Clifford avatar
    25 posts
    Member since:
    Sep 2013

    Posted 07 Oct 2013 Link to this post

    I am facing an interesting problem with the RadRichTextBox. I assemble a document converting documents to fragments, and the documents that contain the fragments can contain merge fields. There will only be a single merge. The assembled document is displayed in a RadRichTextBox that I want to display with the merged values, meaning that I display this RadRichTextBox with "Document.ChangeAllFieldsDisplayMode(FieldDisplayMode.Result)". A second RadRichTextBox displays the document used for assembly, depending on the fragment selected.

    Seems like things are working well with the merge fields except that the values can change, and the changes are not reflected in the assembled document. When I change the ChangeAllFieldsDisplayMode back and forth the changed will be displayed. Any good way to fix this problem?
  2. Answer
    Petya avatar
    975 posts

    Posted 10 Oct 2013 Link to this post


    When a filed is inserted in Display mode and its value changes you have to make sure to update the field in order for the value to take effect. This can be done by right-clicking on the field and choosing the Update Field option. Additionally, you can update a field or all fields in the document using the methods of RadRichTextBox:
    this.radRichTextBox.UpdateAllFields(FieldDisplayMode.Result); //all fields
    this.radRichTextBox.UpdateField(rangeStart); //single field with FieldRangeStart range Start

    I hope this helps!

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Clifford
    Clifford avatar
    25 posts
    Member since:
    Sep 2013

    Posted 30 Oct 2013 Link to this post

    Thanks worked great
Back to Top