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.

Tue Feb 22, 2022 11:42 am

Hello

I would like to know if I can use this library for docx page rendering, so that for example I know height of Header and Footer or how to insert a table with maximal height in the document body (after some Paragraphs)...
If so, I would be thankful for any code sample you can provide me...
Thank you a lot
Best regards

chsoft
 
Posts: 4
Joined: Thu Dec 07, 2017 9:54 am

Wed Feb 23, 2022 6:10 am

Hello,

Thank you for your inquiry.
Our Spire.Doc follows the rules of Microsoft Word, which is flow document and does not contain any information about its layout into pages. So it can't get the height of the Word page. Please use the below code to get the header height, the footer height and the Section height of the Word file.
Code: Select all
Document doc = new Document();
doc.LoadFromFile(inputFile);
//Get the first section
Section section = doc.Sections[0];
//Get the height of headers in the section
float headerHeight = section.PageSetup.HeaderDistance;
// Get the height of footers in the section
float footerHeight = section.PageSetup.FooterDistance;
// Get the height the section
float sectionHeight = section.PageSetup.PageSize.Height;

Sincerely,
Annika
E-iceblue support team
User avatar

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

Return to Spire.Doc