We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with complex bookmark text deletion

thank you.
Unfortunately it works only with certain bookmarks.
With another document and another bookmark whose name is opz_tdet.
I found this exception:
BookmarkEnd 'bookmark.BookmarkEnd' threw an exception of type 'Aspose.Words.PleaseReportException'
Aspose.Words.BookmarkEnd {Aspose.Words.PleaseReportException}

Exception 'Cannot find bookmark 'opz_tdet' in the document.' occured in Aspose.Words for .NET
For free technical support, please post this error and the file in the Aspose.Words Forums http://www.aspose.com/forums/ShowForum.aspx?ForumID=75. at ?.?.?(Node ?, String ?)
at Aspose.Words.Bookmark.get_BookmarkEnd()
at Aspose.Words.Bookmark.set_Text(String value)

My code is:

Bookmark bookmark = _doc.Range.Bookmarks[nome];

//Find row that contains BookmarkStart
Node start = bookmark.BookmarkStart.ParentNode.ParentNode.ParentNode;

//Find row that contains BookmarkEnd
Node end = bookmark.BookmarkEnd.ParentNode.ParentNode.ParentNode;

//Remove rows between start and end
while (!start.Equals(end))
start = start.NextSibling;

//Remove bookmark end
retVal = true;
errors = string.Empty;
catch (Exception exc)
errors = exc.Message + " " + exc.StackTrace;
retVal = false;

Any Ideas?

Thank you



This question is answered in <a href="

Best regards.

Hi, is an another problem!

Please try with this document and this bookmark.



I can’t reproduce this problem on my side. I use Aspose.Words for testing. Please try using the latest version of Aspose.Words.

Best regards.