Hi,
I have a document that has Bookmark in it and I would need to split that document into 2 documents if a specific bookmark exists in it.
Ex. -
Document1 has 6 pages and in 4th Page I have a bookmark (named - Bookmark1) now I will use the below code to find out Bookmark1 exists in the document and once I see Bookmark1 I will have to separate the Document1 into 2 documents (DocumentA - which is the document from Start of the document to Start of Bookmark1 and DocumentB - which is the document from Bookmark1 to End of the document).
//Code to find the particular bookmark exist -
foreach (var bookmark in doc.Range.Bookmarks.ToList())
{
if (bookmark.Name == "Bookmark1")
{
//Split document into 2 (documentA and documentB and stich it back after processing documentA
}
}
After splitting the document into 2, I will do some processing of DocumentA and once the processing is done I will have to stich the processed DocumentA and DocumentB to single document Document1.
Could you please help with the snippet how we achieve this? Thanks!
Regards,
Chetan