Dear morix,
Thanks for your feedback.
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" and "Line" concept in Word document, so it will be very tough to calculate the height of every element accurately, and it depends on lots of things, such as the font you use and where/how the paragraph contents break. Yet after a further investigation on your requirement, we found there is only a way to roughly calculate the position of page break.
Firstly, get the page width and page height as below.
- Code: Select all
pageWidth = section.PageSetup.PageSize.Width - section.PageSetup.Margins.Left - section.PageSetup.Margins.Right;
pageHeight = section.PageSetup.PageSize.Height - section.PageSetup.Margins.Top - section.PageSetup.Margins.Bottom;
Then confirm the position of page break by calculating the height and width of text by yourself. Kindly note this is just a rough calculation, and maybe the breaks are different from the breaks in MS word.
Thanks,
Betsy
E-iceblue support team