We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remaining space on page

Is there a way to determine the remaining space on a page?

I know I can determine the effective page space using:

int heightInPoints = (int) (builder.PageSetup.PageHeight -
builder.PageSetup. TopMargin -
builder.PageSetup.BottomMargin);

But how far am I already in the page itself?

Thanks in advance,
Paul

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your interest in Aspose.Words. Aspose.Words document represents content and formatting of a document, not its layout into lines and pages. This feature is called pagination and it is not released yet. Please see FAQ for more information. So there is no way to determine remaining space on page.

Best regards.

Hello Alexey,

Thanks for your answer. I understand what you mean.

Unfortunately there are situations where you need control over the layout of the page in order to get the best results.

Kind regards,
Paul

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

In some simple cases you can estimate how much vertical space remains on the page and insert page breaks or section breaks where appropriate. This is usually quite difficult but possible if your document is not too complex and is fully predictable. For instance, you can estimate text line spacing and approximate number of lines. Then you add some reserve to guarantee this chunk of text goes to one page. Tables can be set to use fixed row height. Inline images expose their height. You can just try and maybe your case could be easier than I imagine. Also you can show your intermediate results and ask for our advice.

Regards,