We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Split Ms Word Multi Page Document into Separate Files (10 Page Document into 10 files - 1 Page each)

Thread ID:

Created:

Updated:

Platform:

Replies:

131777 Jul 26,2017 01:02 PM Jul 27,2017 09:15 AM Windows Forms 1
loading
Tags: DocIO
Nilofer
Asked On July 26, 2017 01:02 PM

Dears, How can we Split Ms Word Multi Page (having Headers & Footers) Document into Separate Files (10 Page Document into 10 files - 1 Page each).Thanks,

Sethumanikkam Yogendran [Syncfusion]
Replied On July 27, 2017 09:15 AM

Hi Nilofer,

Thank you for contacting Syncfusion support.

The Word document is a flow document in which contents will not be preserved page by page; instead the contents will be preserved sequentially section by section. Each section may extend to various pages based on its contents like table, text, images etc..

Please refer the below KB article which explains the same:
http://www.syncfusion.com/kb/3989/why-it-is-not-possible-to-access-the-word-document-contents-page-by-page

Hence it is not directly possible to access the Word document contents page by page, the same holds in Essential DocIO. As a workaround, you can split the contents of each page as separate section in the input Word document and using DocIO can split into multiple files by sections instead of pages.

Please refer the below code snippet with attached template, and let us know if this helps you.
 
// Loads an existing input document.
WordDocument mainDocument = new WordDocument("Template.docx");
// Iterates each section from main document.
foreach (WSection section in mainDocument.Sections)

{
    // Creates new Word document.
    WordDocument currDocument = new WordDocument();
    // Clones section to current document.
    currDocument.Sections.Add(section.Clone());
    // Saves Word document and closes the WordDocument instance.
    currDocument.Save("Template_" + mainDocument.ChildEntities.IndexOf(section) + ".docx");
    currDocument.Close();
}
mainDocument.Close();
 

Please let us know if you have any other questions.

Regards,
Sethumanikkam.Y


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;