We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Read and replace entire text contents of Word Document

Hi All,

I am looking to translate an English Word Document to Spanish.

Basically, I need to read the entire text contents, translate, and replace entire text contents.

I know I can read the text with WordDocument.GetText.

How can I write it back?  Also, is there a way to preserve formatting?

Thanks,

Philip

1 Reply

DJ Devisri Jothi Syncfusion Team July 28, 2017 12:46 PM UTC

Hi Philip, 
Thank you for contacting Syncfusion support. 
Yes, we can get the text using WordDocument.GetText(), however, the formatting of the content will be eventually lost on replacing the text. We have created a sample to meet your requirement. The sample demonstrates how to retrieve multiple text range in a paragraph and replace with the desired text. You may download the sample from the below link, 
Sample 
Output 
The generated document will be located in the output folder of the provided sample. 
Please let us know if you need any further assistance. 
Regards, 
Devisri

Loader.
Up arrow icon