Forum Moderators: open

Message Too Old, No Replies

print pages with all pages has table header ?

         

bbaydar

6:53 am on Aug 9, 2002 (gmt 0)

10+ Year Member



Hello, I am trying to print a large table which is a list but I need to print the Table Header on top of every page. How can that be done??
Thanks in advance

Nick_W

7:37 am on Aug 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, welcome to WebmasterWorld!

Could you post some code? Your post is a little confusing...

Nick

bbaydar

7:46 am on Aug 9, 2002 (gmt 0)

10+ Year Member



Sure. I connect Oracle database and get records and show them.If user wants to print, she use Print button.But the table header appers only on the first page.Ususally my table has too many rows.But they want to see table header on every page printed. my table is like that:
<TABLE frame=box>
<CAPTION> <B><%=request.getParameter("list")%></B></CAPTION>
<TR>
<TH> </TH>
<TH><font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">LCN/VTAM</TH>
<TH><font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">T/P</TH>
<TH><font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">TA</TH>
<TH><font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">U </TH>
<TH><font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">CRI</TH>
<TH><font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">CTY</TH>
<TH><font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">LOCATION</TH>
<TH><font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">SEC</TH>
</TR>

<%
while(rs.next()) //show table records
%>
<tr >
<td height="30" bgcolor="pink"><font size="1" face="arial">
<%=rs.getString(1)%>
</font></td>
<td height="30" bgcolor="pink"><font size="1" face="arial">
<%=rs.getString(2)%>
</font></td>
<td height="30" bgcolor="pink"><font size="1" face="arial">
<%=rs.getString(3)%>
</font></td>
<td height="30" bgcolor="pink"><font size="1" face="arial">
<%=rs.getString(4)%>
</font></td>
<td height="30" bgcolor="pink"><font size="1" face="arial">
<%=rs.getString(5)%>
</font></td>
<td height="30" bgcolor="pink"><font size="1" face="arial">
<%=rs.getString(6)%>
</font></td>
<td height="30" bgcolor="pink"><font size="1" face="arial">
<%=rs.getString(7)%>
</font></td>
<td height="30" bgcolor="pink"><font size="1" face="arial">
<%=rs.getString(8)%>
</font></td>
</tr>
<tbody> </tbody>
</table>
<form>
<center> <input type="button" value="Print this page" onClick="window.print()"> </center>
</form>

Nick_W

7:50 am on Aug 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm... You may have to generate a new table header ever xx rows, This is a bit tricky as you've found out ;)

Sorry, I can't really think of anything, maybe someone else will be along shortly with a better answer...

Nick

joshie76

8:32 am on Aug 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The <thead> [w3.org] element was added to HTML with just such functionality in mind.

from link above at w3c.org:Table rows may be grouped into a table head, table foot, and one or more table body sections, using the THEAD, TFOOT and TBODY elements, respectively. This division enables user agents to support scrolling of table bodies independently of the table head and foot. When long tables are printed, the table head and foot information may be repeated on each page that contains table data

Unfortunately I don't think any browser supports this yet!

Since you can't tell anything from a client's print setup I think you're facing mission impossible here. You're only hope is to dynamically generate something where you have print control (like a pdf).

creative craig

8:36 am on Aug 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Some one beat me to it

rewboss

10:15 am on Aug 9, 2002 (gmt 0)

10+ Year Member



Unfortunately I don't think any browser supports this yet!

I've tried it out for myself, and at least one of the browsers I have installed supported it. I can't now remember if it was NS6 or Opera 5, it might have been both, but I do remember seeing the printout and thinking, "Wow, that's really cool".

bbaydar

10:18 am on Aug 9, 2002 (gmt 0)

10+ Year Member



Thanks, Thead is not worked .. Do you have detailed info about your solution with pdf?

joshie76

2:10 pm on Aug 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



solution with pdf?

err... I wish it were that easy. I work on intranet applications for companies and sometimes they have to absolutely have reports that work like thick client applications - for this we use third party reporting tools like Crystal Reports. This is generally very hard core coding though (though crystal's a little easier).