Hi
Hi Saeed,
Document doc = new Document(“Document.docx”);<o:p></o:p>
// Set up the document which pages will be copied to. Remove the empty section. <o:p></o:p>
Document dstDoc = new Document();<o:p></o:p>
dstDoc.RemoveAllChildren();<o:p></o:p>
PageNumberFinder finder = new PageNumberFinder(doc);<o:p></o:p>
// Split nodes which are found across pages.<o:p></o:p>
finder.SplitNodesAcrossPages(true);<o:p></o:p>
// Copy all content including headers and footers from the specified pages into the destination document.
ArrayList pageSections = finder.RetrieveAllNodesOnPage(3, 5, NodeType.Section);<o:p></o:p>
foreach (Section section in pageSections)
dstDoc.AppendChild(dstDoc.ImportNode(section, true));
dstDoc.Save(dataDir + “Document Out.docx”);<o:p></o:p>
If you have any issues, please attach your document here for testing.
Best regards,