We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Replace Table cell text in Aspose.Words

I need to search an Aspose.Words document table for flag text (e.g. "*OverSpendFlag*") in a cell and, if it is relevant, clear the text or replace it with a more appropriate value. However, although I can easily find the cell in question even if the number of rows changes, the cell does NOT seem to have a setter.

Can you please advise the solution, i.e., having found the cell, how do I replace its contents with new text. Is it possible?




Thanks for your inquiry. I think, you can achieve what you need after reading the article suggested below:

Moreover, you can also narrow down your find and replace routine to a table by using the following code:

tableToSearch = doc.FirstSection.Body.Tables[0];
tableToSearch.Range.Replace(“old value”, “new
, false, true);

Please let me know if I can be of any further assistance

Best Regards,

Hi Barry,

Thanks for your inquiry.

In addition to Awais’s comment, you may find the following article useful as well: http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/replacing-text-in-a-table.html