Break Up A Word Document into Smaller Word Docs based on TOC

I want to take a Word document that has a TOC and break it
up into separate word docs - one for each TOC item.

So here is the process...
1. Open word doc into aspose word.
1. Enumerate all TOC items
2. For each TOC Item, pick-up all the content and save as a new word doc
with filename same as TOC item.

Hi Nitin,


Thanks for your inquiry. Well, every node of TOC field is represented by a HYPERLINK field. When you click on a TOC item, the control jumps to a particular location in your document pointed by a hidden Bookmark. I think, you can implement the following workflow to achieve what you’re looking for:

1) Get name of the Hidden Bookmark from inside the HYPERLINK Field Code of TOC field.
2) Get references to the BookmarkStart and BookmarkEnd nodes
3) Use code from this article to extract content from Bookmarks
4) Generate documents using the extracted nodes

I hope, this helps.

Best Regards,

Sorry I am struggling with this.

Can you give me the code?

Thank you

Hi Nitin,


Thanks for your inquiry. I am working over your query and will get back to you soon.

Best Regards,

Hi Nitin,


Thanks for your patience. Could you please also attach your input Word document here for testing? I will investigate your scenario on my side and provide you more information.

Best Regards,

Hi Awaisv,

I got the code from another post of mine.

So you can close this one.

Thank you!

Hi Nitin,


Thanks for the additional information. It’s great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,