Free Support Forum - aspose.com

Extract / Split selected pages from Office Documents

Hi Aspose,



I understand that it is possible to extract/split particular pages from
PDF file using pdf kit. I tried and success. But how about office
documents like Word,Excel,PowerPoint ?? I couldn’t find any
documentation for that.





Please assists,



Thanks & Regards

Amerischool


Hi Kaline,

Thanks for your inquiry.

Using Aspose.Words you can convert Word documents to PDF or Image and specify which page range you want to export. Please see the code below.

// Open documents.<?XML:NAMESPACE PREFIX = O />

Document doc = new Document("Document.doc");
PdfSaveOptions options = new PdfSaveOptions();

// Set how many pages to render
options.PageCount = 3;

// The first page to render (index is 0-based).
options.PageIndex = 1;

doc.Save("Document Out.pdf", options);

Regarding the other formats, you will need to ask my colleagues in the other appropriate Aspose forums.

Thanks,

Hi Adam,

Thanks for your help. That means need to convert original word document as pdf.
Any other ways to extract and save as original file format (doc/docx) since word to pdf rendering has some issue on supporting floating objects ,reported before.


Thanks & Regards
Amerischool

Hi Kaline,

Thanks for the additonal information.

The issue with floating tables has been fixed in the recent releases of Aspose.Words. Please try using the latest version from here.

Furthermore, could you please describe exactly how you are planning to use the extracted content? i.e what the expected output is from your program. Perhaps we can provide some other suggestions for you to achieve what you are looking for.

Thanks,

Hi Adam,

Thanks for your help.
The floating table issue has not been fixed yet. Please refer the post

http://www.aspose.com/community/forums/315032/document-cannot-be-rendered-properly-from-word-to-pdf-conversion/showthread.aspx#315032

For extract content,
We need to print selected pages of the office documents(Word,Excel,PPT) and PDF.
Idea is to extract the selected pages from original doc and create a new file.Then convert to Printer Command Language embedded with printer setting and send printer as direct print.

We did try convert office doc to pdf first .Then extract using aspose.pdf.kit and print. It’s working but need to go through so many process and steps.It will be better if can reduce the processing time. And rendering is another concern as well.

Any suggestion?
Thanks & Regards
Amerischool




Hi

Thank you for additional information. Unfortunately, there is no other way to split the document into pages. But I think, in your case you can simply convert the particular page of MS Word document to PDF and then print it, as Adam already suggested.

Also, you can specify index of page that should be printed in PrinterSettings:

PrinterSettings settings = new PrinterSettings();

settings.MinimumPage = 5;

settings.MaximumPage = 5;

Best regards,