Replacing Text string with html

I'm looking for the best way to replace text in a word doc with some HTML. For example, I have a Word doc with one or more instances of the text "InsertHtmlHere". I'd like to replace this with some HTML like "<b>Some Bolded Text</b>". 

The HTML will be more complex than this but this should give you the idea of what I'm trying to do.

Thanks

3 Replies

MJ Mohanaselvam Jothi Syncfusion Team August 4, 2017 06:39 AM UTC

Hi Tom,

Thank you for using Syncfusion products.

Yes, you can use replace functionality in DocIO to replace text in a Word document. We have prepared a sample to illustrate how to replace text in Word document as per your requirement. The sample can be downloaded from following link.

Sample link: http://www.syncfusion.com/downloads/support/forum/131924/ze/GenerateWord_Windows-1725102197.zip

To know more about replacing functionality, please refer the below UG documentation link:
https://help.syncfusion.com/file-formats/docio/working-with-find-and-replace#replacing-the-search-results

Please let us know if this sample fulfills your requirements.

Regards,
Mohanaselvam J
 



GW Gerry Winning August 4, 2017 03:02 PM UTC

Thanks for this. Unfortunately, this doesn't do what I asked for. Perhaps I wasn't clear.Yes, the text is replaced but instead of seeing <b>Some Bolded Text</b> in the document, I want to see Some Bolded Text .





RH Ramanan  Hariharasubramanian Syncfusion Team August 7, 2017 09:14 AM UTC

Hi Tom,

Thank you for using Syncfusion products.

Yes, you can
replace a text with html formatted text in a Word document using DocIO. We have prepared a sample to illustrate how to replace text with html formatted text in Word document as per your requirement. The sample can be downloaded from following link.

Sample link: http://www.syncfusion.com/downloads/support/forum/131924/ze/ReplaceString-254841725

Please let us know if this sample fulfills your requirements. 

Regards,
Ramanan H 
 


Loader.
Up arrow icon