Multiple Text Colours For Single MergeField

Hi,

I am looking for a way to generate a Word document with DocIO that somehow sets the text colour of a single merge field to multiple colours.

For example, if the merge field called RedBlackField results in the text of "Red Black". I want the "Red" text to appear as red, but the "Black" text to appear as black. 

These can't be multiple merge fields in my case, it needs to all be configurable via one field.

Any input or suggestions would be greatly appreciated.

Thanks,
Darien

1 Reply 1 reply marked as answer

SB Suriya Balamurugan Syncfusion Team July 22, 2020 03:08 PM UTC

Hi Darien,

Thank you for contacting Syncfusion support.

We have prepared the sample application to set the text colour of a single merge field to multiple colours as per your requirement. It can be downloaded from the following link:
https://www.syncfusion.com/downloads/support/forum/156249/ze/MailMerge897464488

In the above sample, we have done the following things:
  1. Loads the template Word document.
  2. Split the field value and applies separate colour for each by using MergeField Event.
  3. Performs simple mail merge.
  4. Saves the Word document.

Note: Please find the input Word document in the “Data” folder of above sample application.

If we misunderstood any of your requirement, then kindly provide us sample or modified sample of above along with input template, and screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution at the earliest

Please let us know if you have any other questions.

Regards,
Suriya Balamurugan.


Marked as answer
Loader.
Up arrow icon