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.

Wed Sep 29, 2021 7:01 am

Hello,
i need word document to load in to a Spire.Doc.Document Object and calculate the total height it takes for this document. how do i achieve this?
for the moment im following the tutorial https://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/Text/How-to-get-the-height-and-width-of-text-in-word-document-in-C.html

however i need to select the whole document and calculate the Height.

infra
 
Posts: 18
Joined: Tue Apr 03, 2018 12:05 pm

Wed Sep 29, 2021 9:51 am

Hello,

Thank you for your inquiry.
The tutorial you referred to shows how to get the text height, the document height depends on many factors, such as header/footer, line spacing and so on. It is very complex to calculate document height. Sorry we have no way available to get document height at present. But we provide the following properties to get page height of section, maybe you could have a try. If you have any question, please feel free to write back.
Code: Select all
//Get height of page
float height = doc.Sections[0].PageSetup.PageSize.Height;
//Get height of client area
float heightClient = doc.Sections[0].PageSetup.ClientHeight;

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1642
Joined: Wed Apr 07, 2021 2:50 am

Fri Oct 08, 2021 6:55 am

Hello,

Hope you're doing well!
How is your issue going? Did the code we provided work for you? Any feedback will be greatly appreciated.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1642
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc