One file into separate files

Can your Aspose.Words extract one file into Separate files like doing in Aspose.Slide?

This message was posted using Email2Forum by Merit.

Thank you for your interest in Aspose.Words. Yes you can split single Word file into separate files using Aspose.Words. For example the following code saves each section of word document into the separate file.

// Open document
Document srcDoc = new Document(@"Test202\in.doc");
// Loop through all sections in document
int sectIndex = 0;
foreach (Section srcSection in srcDoc.Sections)
    // Create new empty document
    Document doc = new Document();
    // Remove first section of document
    // Import srcSection
    Section dstSection = (Section)doc.ImportNode(srcSection, true, ImportFormatMode.KeepSourceFormatting);
    // Insert section into the created document
    // Save document
    doc.Save(@"Test202\out_" + sectIndex.ToString() + ".doc");

Best regards.

Thanks alexy,
For your Quick Reply…
But this code doesnot worked at all.
In my Doc file having 10 Pages and i want to extract each of those(1 out of 10)
into separate separate Doc files, but this wont do as your code.
Please give me exact solution for this.
Also i want to ask you can we apply Thumbnail image for each of those Separate files.
Please reply me.
Thanks in Advance


Thanks for your request. I already answered these question in another your thread. Please see the following link.

Best regards.