Copying bookmarks betwen documents


Hi Vladimir.

I’m trying to do the following using Aspose.Word, but I think that your control does not support it:

I have a Bookmark (BM1) that have another bookmark (BM2) inside. I want to create a copy of the bookmark BM1 in a new document, but I want to keep the bookmark BM2. How I can do these with Aspose?


Jose Díaz


After a small research I have found that this task cannot be solved reliably with our current API. That is mainly due to treelike object model that is used in Aspose.Words. The document tree hierarchy can be quite deep and bookmark delimiters can occur on any level of the hierarchy. The problem is described in details here:

Technically, the problem can be solved with the current object model. But in practise the code will be very complex and will require much time for its development and testing.

So right now you can only copy bookmark text between documents. All formatting will be lost in the process. Of course if we make some assumptions about bookmarked regions, for example that bookmarks will span entire sections of the document or whole paragraphs then the task will be simplified and can be solved easier.

Best regards,