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.

Fri Dec 02, 2016 2:59 am

Document object has a method GetPageCount to get total page count of the document.For a specific section,how can I get its page count?

Jay.L
 
Posts: 8
Joined: Fri Dec 02, 2016 2:54 am

Fri Dec 02, 2016 3:15 am

Dear Jay.L,

Thanks for your inquiry.
Sorry that I am afraid that it is not possible to get page count of a section.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Dec 02, 2016 8:51 am

Betsy.jiang wrote:Dear Jay.L,

Thanks for your inquiry.
Sorry that I am afraid that it is not possible to get page count of a section.

Sincerely,
Betsy
E-iceblue support team

Thanks for your reply.I tried a method like this: create a temp document in memory and copy the section in, then get the page count of the temp document by doc.GetPageCount() method.It works!
If the later API version can provide related member method,it will be better.

Jay.L
 
Posts: 8
Joined: Fri Dec 02, 2016 2:54 am

Fri Dec 02, 2016 9:02 am

Dear Jay.L,

Thanks for sharing the solution.
MS Word document is flow document and does not contain any information about its layout into lines and pages. And the start/end of the section may be on the center of one page, it means the section doesn't include whole page, it is difficult to determine the page count in this case. So I am afraid it is not possible to have that fucntion to get the page count of a section. Thanks for your understanding.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc