Free Support Forum -

Replacing repetitive words dynamically


How do i replace repetitive text dynamically using aspose.

For example in the below para, COMPANYNAME is a text that has to be replaced dynamically. One option that strikes my mind is having three different bookmarks and replacing the text. But having three different bookmarks for the same text doesnt make any sense. Can you suggest something in the lines of having one bookmark for all similar text and replacing it so that it is logical?

COMPANYNAME shall be responsible for compliance of the equipment with technical requirements or standards imposed by codes or regulations of the country where the equipment is to be used ONLY WHEN specific mention of the proposed use and destination of the equipment and of such requirements or standards is made in the order and in COMPANYNAME acceptance thereof, AND when a copy of such provisions is furnished to COMPANY NAME prior to the acceptance of the order.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />



Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You can use Replace method to replace some text inside the document. For example see the following code.

Document doc = new Document(@"Test145\in.doc");

doc.Range.Replace("COMPANYNAME", "Aspose", true, true);


Also I think that you can use mail merge in this case. Please see the following links for more information.

I hope this could help you.

Best regards.

This works!

thanks a lot for your quick reply.