Free Support Forum - aspose.com

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<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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

http://www.aspose.com/community/forums/thread/128780/functionality-of-an-aspose.word.aspx

Best regards.