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

MergeField, CustomField update problem.

1 Answer 37 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
MURAT ERAYDIN
Top achievements
Rank 1
MURAT ERAYDIN asked on 09 Nov 2012, 08:43 AM

Hi,

The scenerio we are working on:

  • User A opens a template (docx) with RadRichTextBox.
  • Template has two MergeFields, "Subject" and "Signed".
  • User A updates the document and "Subject" MergeField is set to "User A's Subject".
  • Then User A saves the document as Docx and sends it to User B.
  • User B signs the document and "Signed" MergeField should be set to "Yes", but "Subject" MergeField shouldn't be updated.

 

The problem is, when User B opens the document, application does not have the User A's MergeFieldSource. So when application merge fields, it updates both "Subject" and "Signed" MergeFields.
 

I've tried couple of solutions, one with RadRichTextBox.MergeFieldToStringConverting event and one with inheriting MergeField.

In RadRichTextBox.MergeFieldToStringConverting solution, MergeFieldToStringConvertingEventArgs doesn't have the old/original value (before merging). If it was, I could pass the old value to the "Subject" MergeField when User B updates the document.

In CustomField implementation, I could have find a solution, if there were a functionality like; when protected override DocumentFragment GetResultFragment() method returns null, corresponding MergeField does not updates it's own value. But there is no such a functionality.

One another solution could be, enumerating the MergeFields in the document and update only the required ones. (This is possible in Office Word API). But I couldn't find a way to achieve the is with RadRichTextBox.

I've added a sample solution demonstrating the scenerio. (Using Telerik version 2012.3.1017.45)

Regards.

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 12 Nov 2012, 12:41 PM
Hi Murat,

This scenario is similar to the task of having multiple items sources for mail merging. It is not supported out of the box, but you can use dynamic objects in order to implement it.

You can find attached a modified version of your project illustrating how this can be done in the support ticket you have opened.

Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
MURAT ERAYDIN
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or