Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing tables where each rows data is on same page

Status
Not open for further replies.

thomsons

Programmer
Dec 16, 2002
19
GB
I currently have a web page which contains a table which is populated by reading a recordset which is constantly changing.

Currently when you print this page the table populates multiple pages and some of the data in rows starts at the foot of one page and then ends at the beginning of the next page.

Is there a way that when this page is printed it will start a new page if all the data in a row is not on the same page?

Thanks in advance to any assistance with this one.

Shaz
 
You could try putting all of your rows inside a tbody tag inside the table, this will give you the added advantage of being able to use a thead tag which will (with newer browsers) display some given column headers at the top of each page that the table prints on.
Code:
<table>
   <thead>
      <tr><th>Column 1</th><th>Column 2</th></tr>
   </thead>
   <tbody>
   ...the rest of your rows here
   </tbody>
</table>

While that doesn't directly solve your page wrap issue, it should solve it indirectly. I seem to remember some sort of attribute that forces text to the next page rather than page breaking in the middle of it, but I could be thinking of something from VBA rather than HTML.

-Tarwn ________________________________________________
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
I have the same problem with one of my applications. I have not come across a solution where you can detect the end of the page and so force a page break, however, it is possible to force a page break using tags.

This link explains how...


If the rows in your table are all the same height, you could count the number of records that fit on one page and then force the page break.

I havn't tested on all browsers/versions as I use it in a controlled intranet environment.
BDC.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top