PDA

View Full Version : Maximum Lines Per page in Word



natel
05-20-2010, 05:09 PM
Does anyone know how to set a maximum amount of lines per page in word through VBA or VB.Net? Any help would be much appreciated.

TonyJollans
05-21-2010, 04:39 AM
You can't, not really.

You could write some VBA code that went through a document and inserted hard page breaks according to whatever rules you chose but the minute anything was changed you'ld have to redo it.

If you know the font size and the page size - and they're never going to change (something you can't really enforce) - you could calculate the page depth that would hold your maximum and set header and/or footer sizes to constrain the page.

Why do you want to do this - and in what kind of environment?

fumei
05-21-2010, 09:29 AM
I have to agree. Besides, as Word derives "page" by whatever printer driver is active, it is VERY possible that the document viewed on a different machine can have a different maximum.

As Tony mentions, you could make some arbritrary determination and use hard page breaks to create that. But the slightest change could easily screw things up.

I too would like to know what is the requirement for this.