How to detect Height of the printable area in Excel Print Preview?
Each time, after I change Font in the Format -> Style dialog box, it has different value
What you'd need to do is:
a) calculate this maximum possible number of points height within the page margins; then
b) add up the point heights of all rows until you can't fit any more into the number of number of points height within the page margins, keeping a row count as you go along.
When you say "Excel has it is own routine to determin(e) height of printable area, and this value (may) vary depend(ing) on font stle and size", that is only because Excel adjusts row heights to suit the font requirements. If you were to fix the row heights, then changing fonts would have no effect.
Take a look at the 'table craziness' thread in this forum from 29 July for a discussion on fitting Word tables to page heights. Although that discussion concerned making a given number of rows fit the page, it deals with many of the same issues you'd be dealing with in tring to determine how many rows from an Excel spreadsheet would print on a page.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.