By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,654 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,654 IT Pros & Developers. It's quick & easy.

Prevent generated tables breaking over page

100+
P: 170
Hi all,

Problem: multiple tables of different heights (depending on amount of content) produced from database. Tables print down page and often break over the page. Number of tables and height of each table is generated on the fly.

Is there a way to "recognise" that the next table will be broken and therefore to page break before it? I presume js would be needed if this is possible. This is purely for printing purposes, not for screen display.

Thankyou
Nov 7 '08 #1
Share this Question
Share on Google+
2 Replies


rnd me
Expert 100+
P: 427
not all browsers support it, and it's a print media rule, but check out http://www.w3schools.com/Css/pr_print_pagebb.asp

if you are talking about onscreen, you will have to calculate the height of the table and compare it to the height of the screen. browser inconsistencies make this much more complicated than it sounds, but it can be done.
let me know if any of this helps, or you need more.
Nov 7 '08 #2

100+
P: 170
Thanks for your help. I do know about the page-break-before property and use it quite a lot. What I can't do is being able to somehow calculate page height and height of tables etc. So I definitely need more help. Basically what I need to do is be able to print out multiple pages (dynamically generated of course), but make sure that no tables break over a page. Any ideas?

not all browsers support it, and it's a print media rule, but check out http://www.w3schools.com/Css/pr_print_pagebb.asp

if you are talking about onscreen, you will have to calculate the height of the table and compare it to the height of the screen. browser inconsistencies make this much more complicated than it sounds, but it can be done.
let me know if any of this helps, or you need more.
Nov 7 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.