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.

Hi
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
    doc.Sections.Clear();
    // Import srcSection
    Section dstSection = (Section)doc.ImportNode(srcSection, true, ImportFormatMode.KeepSourceFormatting);
    // Insert section into the created document
    doc.Sections.Add(dstSection);
    // Save document
    doc.Save(@"Test202\out_" + sectIndex.ToString() + ".doc");
    sectIndex++;
}

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.
thanks
Please reply me.
Thanks in Advance

Hi

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

Best regards.