- Code: Select all
BookmarksNavigator navigator = new BookmarksNavigator(spireDoc);
navigator.MoveToBookmark(bkm.Name);
TextBodyPart part = navigator.GetBookmarkContent();
foreach (DocumentObject child in part.BodyItems)
if (child is Table)
{
table = child as Table;
break;
}
This gives me a valid reference to a table object, and when I remove a row, I see in the debugger the row gets removed from the rows collection in the table, but when the final document is printed, all of the rows are still there.
I added to this code the command before removing the row: tableRow.Cells.Clear()
After this, the cells collection shows Count = 0, but when the document prints, all of the cells are still present in the row.
I have tried both table.Rows.RemoveAt(1) and using a reference to the row, table.Rows.Remove(tableRow)
The table object changes in the debugger but the document does not get updated.
Am I using the table object incorrectly?
(using free Spire.Doc to set up a suitable demonstration to request purchasing the product)
Note: My source is a Word .dot template, which I update at various bookmarks, then save the final document as a PDF.