private static void DeleteRowByBookmark(Document doc, string bookmarkName)
{
// Find the bookmark in the document. Exit if cannot find it.
Bookmark bookmark = doc.Range.Bookmarks[bookmarkName];
if (bookmark == null)
return;
// Get the parent row of the bookmark. Exit if the bookmark is not in a row.
Row row = (Row)bookmark.BookmarkStart.GetAncestor(typeof(Row));
if (row == null)
return;
// Remove the row.
row.Remove();
}
}