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

Free Support Forum - aspose.com

How to read between two bookmarks and insert bookmarks in the same

Hi,

Please guide me how to read between two bookmarks and add bookmarks between the two bookmarks.

Please find attached test.doc and result.doc.
We need to read between the “start_doc” and “end_doc” bookmarks and add bookmarks on list items.
The test.doc is the document to be read and the result.doc is the expected output.

Thanks in advance.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I think, in your case you should use DocumentVisitor to extract content between bookmarks from one document. Please follow the link to learn more about DocumentVisitor:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/documentvisitor.html

In your particular case, you should start collecting nodes when you visit BookmarkStart of the bookmark that mark start of region and end collecting nodes when visit BookmakEnd of bookmark that marks end of region.

Then you can insert collected nodes into the destination document. You can achieve this using the technique described here:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/howto-insert-a-document-into-another-document.html

Hope this helps. Please let me know if you need more assistance, I will be glad to help you.

Best regards.