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

Free Support Forum - aspose.com

Rplacing random text in document

I have converted my PDF using Aspose PDF into a word docs. this doc contains a table with “Comments” as text in one table cell and in the next cell we have comment value. Please check the attached screenshot for your reference. I want to find all the comments inside the table by searching “Comments” string and replace the comments value with a text “Done” these are the comments entered by user hence are not in specific format. The only clue which I have for replacement is to replace text in the cell next to the cell containing text “Comments”. Please let me know if this can be achieved with any of Aspose tool. My source document is PDF .

image.png (21.3 KB)


Thank you for contacting support.

You can extract text from a table using below code snippet and search for the text you are interested in. Once that text is found in any cell, you can then redact text of next cell as per your requirements.

Document pdfDocument = new Document(dataDir + "Test.pdf");
TableAbsorber absorber = new TableAbsorber();
foreach (AbsorbedTable table in absorber.TableList)
  foreach (AbsorbedRow row in table.RowList)
      foreach (AbsorbedCell cell in row.CellList)
          TextFragment textfragment = new TextFragment();
          TextFragmentCollection textFragmentCollection = cell.TextFragments;
          foreach (TextFragment fragment in textFragmentCollection)

Alternatively, you may try to Work with Tables then Find and Replace text in the Word document with Aspose.Words for .NET API.

If you still face any problem then please share source and generated files with us. We will be glad to assist you further.