HTML tables

liunx

Guest
HTML documentation leads me to believe that it is possible to have table headers repeat on long tables when printing.<br />
<br />
For some reason, I cannot get this to work. Whenever multiple pages are printed, the header only appears on the first page.<br />
<br />
Here's my code:<br />
<br />
<br />
<table border=0><br />
<br />
<thead><br />
<tr><br />
<th scope=col align="left">Column 1</th><br />
<th scope=col align="left">Column 2</th><br />
<th scope=col align="left">Column 3</th><br />
<th scope=col align="left">Column 4</th><br />
<th scope=col align="left">Column 5</th><br />
<th scope=col align="left">Column 6</th><br />
<th scope=col align="right">Column 7 ($)</th><br />
</tr><br />
</thead><br />
<br />
<tbody><br />
<tr><br />
<td valign="top">Field 1</td><br />
<td valign="top">Field 2</td><br />
<td valign="top">Field 3</td><br />
<td valign="top">Field 4</td><br />
<td valign="top">Field 5</td><br />
<td valign="top">Field 6</td><br />
<td align="right" valign="top">Field 7</td><br />
</tr><br />
<br />
<tr><br />
<td valign="top">Field 1</td><br />
<td valign="top">Field 2</td><br />
<td valign="top">Field 3</td><br />
<td valign="top">Field 4</td><br />
<td valign="top">Field 5</td><br />
<td valign="top">Field 6</td><br />
<td align="right" valign="top">Field 7</td><br />
</tr><br />
<br />
:<br />
:<br />
:<br />
<br />
<tr><br />
<td valign="top">Field 1</td><br />
<td valign="top">Field 2</td><br />
<td valign="top">Field 3</td><br />
<td valign="top">Field 4</td><br />
<td valign="top">Field 5</td><br />
<td valign="top">Field 6</td><br />
<td align="right" valign="top">Field 7</td><br />
</tr><br />
</tbody><br />
</table><br />
<br />
<br />
(Actual data has been removed due to sensitivity).<br />
<br />
There are approximately 1700 lines in the table, which is generated by an ASP script.<br />
<br />
Why won't this output my header cells on every page, and more importantly how can I make it do so?<!--content-->You are right that HTML 4.0 does include this. What it ommits to mention is that it has poor browser support. I believe IE5.0 and above support it but can't vouch for any others.<br />
<br />
Also, if you use the thead, tfoot and tbody elements, you must use every element, but you can leave them blank They should appear in this order: <thead>, <tfoot> and <tbody>, so that browsers can render the foot before receiving all the data.<br />
<br />
Try looking here:<br />
<!-- m --><a class="postlink" href="http://www.htmlhelp.com/reference/html40/new.html">http://www.htmlhelp.com/reference/html40/new.html</a><!-- m --><!--content-->I haven't been able to make this work reliably in any browser -- so if you can get it to work for you, I'll be interested to know how you did it.<br />
<br />
-beth<!--content-->There is no browser in existence yet that has fully implemented the <br />
complex table model behaviours; and none recognize the pagination of<br />
tables.<br />
<br />
You will not get what you want that way.<br />
<br />
In your ASP you will have to count the lines and at the point where <br />
need the page break put in the headings. Or convert to PDF.<br />
<br />
There is a style attribute supporte by IE only the will force a page<br />
break where you want it:<br />
<br />
page-break-after:always<br />
<br />
However palcing it correctly in a table structure makes it unreliable<br />
even in IE because of the way inheritance works for table elements.<!--content-->The report was printed from IE 5.5, but there was no pagination happening.<br />
<br />
I guess that, since PDF conversion isn't an option right now, I'll have to count lines in ASP. What a pain in the rump.<br />
<br />
Thanks for the feedback :)<!--content-->
 
Back
Top