Section break/Bookmark bug

I’ve starting converting a Word Automation doc creator to Aspose. It’s going fairly well, but I ran into a minor bug.

Short version: When a bookmark crosses a section boundary, it can’t be accessed

Long Version: Our original code cuts/pastes from one document to another, finding the areas it needs to cut/paste using bookmarks.
Since Aspose.Word can only cut/paste non-text data at the section level, and sections can’t identified by name, what I decided to do was wrap each bookmark in continuous section breaks. The system then loops through each document section, see if the bookmark we want is in there, and if so selects that section.
Once it’s done creating the doc, it loops through each section and deletes all the bookmarks before it saves it.
What happened was that initially I put the cursor at the very beginning of the bookmark and inserted the section break at the same place. But when trying to delete the bookmark, the For Each loop would find the bookmark, but when I tried to remove it, it would throw an exception. During debugging, I found that Bookmark.Name would return the correct value, but Bookmark.Text would return an error, as would Bookmarks.Remove(“ThisBookmark”). In addition, I realized that it had found the bookmark in the section previous to where I thought it was. So I assume that by placing the section break where I did, I actually split the bookmark between 2 sections.

I’m able to workaround it without too much trouble by just moving the bookmark inside the section a character, but I figured you’d want to know.

Geof

Hi Geof,

Thank you very much for your report. We will certainly look into this problem.