I am cloning table rows in a Word document that satisfy a specific criteria - e.g. the table row contains the text ‘Row B’. After cloning the row a number of times I want to keep processing through the rest of the table rows. At the moment, after cloning, control seems to return to the row I originally cloned - i want to continue processing table rows after the newly added clone rows - otherwise I get an infinite number of clone rows. Any ideas how I might do this.
foreach(Row row in table.Rows)
{
foreach(Cell cell in row.Cells)
{
NodeCollection cellCollection = cell.GetChildNodes(NodeType.Run, true);
foreach(Run run in cellCollection)
{
if (run.GetText().Contains("Row B"))
{
// clone row B 2 times
}
}
}
}
I have included a document showing before and after examples of the table I want. I am using Aspose.Words 8.0.0.0.