I tested v6.12 and v8.1.10 versions of spire.doc
My bookmark encloses the paragraph mark at the end of line, and DeleteBookmarkContent removes text, shapes, tables, even other eventually paragraphs contained in bookmark but not the first one. It only removes it's content.
And I cannot find the way to simply delete this last paragraph
I have tried this way :
TextBodyPart part = nav.GetBookmarkContent();
Paragraph paragraph = part.BodyItems[0] as Paragraph;
But I do not know how to remove this paragraph, because I only know : section.Paragraphs.Remove(xxx)
And I cannot find the section of the remaining paragraph.
- Code: Select all
private void CleanUpBodyPart(BookmarksNavigator nav, string bookmarkName)
{
nav.MoveToBookmark(bookmarkName);
nav.DeleteBookmarkContent(false);
nav.Document.Bookmarks.Remove(nav.CurrentBookmark);
}
I have attached a document with which I did the test.
The bookmark name is "CircleModel"