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

Free Support Forum - aspose.com

Bookmarks are imported at incorrectly into Aspose.Words DOM using C#

Hello,
we were using the following line of code for our bookmark which is in a table:
Paragraph parentParagraphOfBookmarkEnd = (Paragraph)bookmarkEnd.ParentNode;
This was an essential step in our algorithm to remove bookmarks and it was working until Aspose 18.5, where each bookmark was a child of paragraph node.
Now we wanted to upgrade and since 18.6 and also the newest version 19.3 we get the following mentioned bug. It seems that the previous rule has changed and now our algorithm does not work anymore with the new Aspose version. How can we fix the problem now?

@stanlife

The bookmark nodes are allowed to be placed on the block, cell and row levels in the latest version of Aspose.Words for .NET 19.3. We suggest the you please read the following article.
Working with Bookmark on Block, Cell, Row Levels

You can check the API changes in Aspose.Words for .NET 18.9 release notes .

Please use LoadOptions.AnnotationsAtBlockLevel property as shown below to avoid the shared exception.

LoadOptions options = new LoadOptions();
options.AnnotationsAtBlockLevel = false;
Document doc = new Document(myDir + "in.docx", options);

It seems that this feature (options.AnnotationsAtBlockLevel = false;) will be deprecated in the future. Is there a end of support time of that?

@stanlife

Yes, your understanding is correct. Currently, we do not have any plan to deprecate this property. We will inform the users via blog post and release notes when it is deprecated.

Hello, I have now update to Aspose.Word 20.4 and it seems that AnnotationsAtBlockLevel does not exist anymore. Is this correct? Now my code does not work anymore. How can I fix the problem that I showed before?

@stanlife

The obsolete properties LoadOptions.AnnotationsAtBlockLevel and LoadOptions.AnnotationsAtBlockLevelAsDefault have been removed. The mode of moving annotation nodes to inline-level is no longer supported.

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.