Re: Page break in html table

>>>>> "KJ" == Katonica, Jason <Jason.Katonica@ogs.state.ny.us> writes:

 KJ> I was wondering if anyone knows how to insert a page break into a
 KJ> HTML table so that i can control what the print out of a table on
 KJ> my web site looks like.  I want the table to be one continuous
 KJ> table when viewed from the web browser (IE4) but i want to
 KJ> control what parts get printed on seperate pages.  Maybe the
 KJ> solution is to use a hidden character?  The main problem is that
 KJ> when my table is printed it will page break in the middle of a
 KJ> line of text.  Any help is greatly appreciated and thanks in
 KJ> advance.

If you just want to avoid page-breaking 'in' table cells (i.e. put all 
page breaks between table rows), you should include this in your
stylesheet:

TR { page-break-inside: avoid; }

If you want to keep a number of rows together, put them in a colgroup
and applyt the style to COLGROUP instead of TR. Example:

<style type="text/css">
COLGROUP { page-break-inside: avoid; }
</style>

<table>
  <thead>
    <tr> ... header line(s)
  </thead>
  <colgroup>
    <tr> ... line 1
    <tr> ... line 2
  </colgroup>
  <colgroup>
    <tr> ... line 3
    <tr> ... line 4
  </colgroup>
</table>

Here, line 1 and 2 should be kept on one page, and line 3 + 4 on one
page. If there is a page break before line 3, the header line should
be repeated on the new page.

Note, however, that this is only how I think it should work (after
reading (parts of) the current HTML and CSS recomendations), I'm not
sure if there are a browser (or postscript generator) that confirms to 
this yet (I am about to start writing such a postscript generator, if
I don't happen to stumble accross one instead, anyone on this list
interested in taking part of this open-source, 'free' project?).

// Rasmus

-- 
kaj@cityonline.se --------------- Rasmus Kaj - http://www.e.kth.se/~kaj/
 \               CityOnLine IB Production AB - http://www.CityOnLine.se/
  \------ You are responsible for any misinterpretation of your messages

Received on Tuesday, 7 July 1998 11:09:28 UTC