Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Sun Mar 28, 2021 3:36 am

Hi

it is possible to get all the content of a page from a document of a total of 3 pages and save it in a new file?
Any help would be appreciated. Thanks, Jorge.
Please supply the code sample.

PolloKulos
 
Posts: 7
Joined: Sun Mar 28, 2021 3:23 am

Mon Mar 29, 2021 2:39 am

Hello,

Sorry for the late reply as weekend.

Actually, MS Word document is flow document and does not contain any information about its layout into lines and pages. Technically, there is no "page" concept.
In our internal code, we count page numbers by calculating content in the document. It will be very complex to calculate the height of every element accurately, it depends on lots of things, such as the used font and where/how the paragraph content breaks. We are very sorry that our Spire.Doc currently does not have an API that allows you to determine where page starts or ends.

To achieve your requirement, a better way is to manually add some markers (such as page break, section break, etc.) to the end of the page, and then get the page content based on the markers and save it to a new document. You could refer to the following tutorials to split pages by page breaks and section breaks.
https://www.e-iceblue.com/Tutorials/Spi ... -in-C.html
https://www.e-iceblue.com/Tutorials/Spi ... -in-C.html

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc