Get a specific page in a word document

is it possible that if i have a word document of 10 pages,
get page 5 for example(index) in order to save it in an OutputFileStream for example?
i found something similar like:
ImageSaveOptions
options = new ImageSaveOptions(…)
options
.setPageIndex(pageIndex);

in WordSaveOptions or DocSaveOptions we do not have this option.

Hi there,


Thanks for your inquiry. Please note that MS Word document is flow document and does not contain any information about its layout into lines and pages. Therefore, technically there is no “Page” concept in Word document. Pages are created by Microsoft Word on the fly.

Aspose.Words uses our own Rendering Engine to layout documents into pages. The Aspose.Words.Layout namespace provides classes that allow to access information such as on what page and where on a page particular document elements are positioned, when the document is formatted into pages. While usingAspose.Words.Layout this exception should not be occur.

We have already logged a ticket in our issue tracking system for code sample to split a document into multiple documents, one per page as WORDSJAVA-824. We will update you via this forum thread once the code sample of DocumentPageSplitter is available. We apologize for your inconvenience.

Hi,


Thanks for being patient. Please see the attached classes and try executing the following code:
Document doc = new Document(“C:\Temp\in.doc”);
LayoutCollector layoutCollector = new LayoutCollector(doc);
doc.updatePageLayout();
DocumentPageSplitter splitter = new DocumentPageSplitter(layoutCollector);
Document pageDoc = splitter.GetDocumentOfPage(5);
pageDoc.save(“C:\Temp\out.doc”);
I hope, this helps.

Best regards,
1 Like

The issues you have found earlier (filed as WORDSJAVA-824) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.