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];
iRow++;
//Loop to get each cells of row
int iCell = 0;
while (iCell < row.Cells.Count)
{
Cell cell = row.Cells[iCell];
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