Free Support Forum -

Having problem when delete and insert text in table cell

I have delete the text 2 of column ID, then insert Peter Inserted to column Name and 022022022 Inserted to column Phone.

My table has 3 columns ID, Name, Phone

Here is my code:
//Compare 2 files word
Document doc1 = new Document(document1); // doc1 is OriginalTable.docx
Document doc2 = new Document(document2); // doc2 is FormattedTable.docx
doc1.Compare(doc2, “a”, DateTime.Now);

//Get all tables in the section
foreach (Aspose.Words.Section section in doc.Sections)
NodeCollection tables = section.Body.GetChildNodes(NodeType.Table, true);
foreach (Aspose.Words.Tables.Table table in tables)
//Get the change table
if (IsChangesTable(table))
//Loop to get each rows
int iRow = 0;
while (iRow < table.Rows.Count)
Row row = table.Rows[iRow];
//Loop to get each cells of row
int iCell = 0;
while (iCell < row.Cells.Count)
Cell cell = row.Cells[iCell];
When debugging I get row.Cells.Count equals 5 instead of 3. However it doesn’t matter me. The big trouble is the order index of each cell isn’t following the order of table row.
It return me cell Peter Inserted - 2 - 022022022 Inserted instead of 2 - Peter Inserted - 022022022 Inserted
Hi Minh,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 16.12.0 and have not found the shared issue. Please use Aspose.Words for .NET 16.12.0. The Rows.Count returns value 3 and Row.ToString(SaveFormat.Text) returns following value:

Peter Inserted
022022022 Inserted

For more details, I have attach Original Table and Deleted Table, my debugging line by line screen shot.

It returns 5 instead of 3 with wrong index order.
I have already downloaded Aspose.Words with version
Hi Minh,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word documents.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.

Thank for your replying, I attached the console app. You can debug and get the problem issue.

Hi Minh,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14686. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-14686) have been fixed in this Aspose.Words for .NET 17.2.0 update and this Aspose.Words for Java 17.2.0 update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.