Solved

Repeating Column Headers when printing a table

Posted on 1998-09-16
15
330 Views
Last Modified: 2012-06-27
I want to print out a report that is built as an html table.  I want each page to print the column headers and if possible, a footer (last row) on each page.  I thought just changing the <td> tag to <th>  would do it but this doesn't seem to work.  Thanks for the help.
0
Comment
Question by:ehst
  • 6
  • 4
  • 2
  • +3
15 Comments
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
all that <TH> does is make it's contents bold, so as to look like a header.  It doesn't do anything for placement in the table.
I'm not exactly sure what you are looking for.  Could you perhaps provide the code you currently have and explain what you would like it to look like.
Or explain in a little more detail?

-Josh
0
 

Author Comment

by:ehst
Comment Utility
Right.  I just want to be able to print a hard copy of the report with the headings showing up on every page.  
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
I'm afraid, I still don't fully understand.  You say print a hard copy, so I assume you mean when the user clicks on the print button?  For this to work it has to be actually on the web page how you want it to look.  It should look the same when printed except when using background images and layers and then the printed copy tends to look different.

What are you using to generate these reports?  CGI, JavaScript, ASP, etc..

-josh
0
 

Author Comment

by:ehst
Comment Utility
We're using a VB ActiveX dll called through ASP.  The dll builds the report and sends it as an html <table> to the ASP.  Yeah, I want to just use the print button.  Is there a way to put in page breaks maybe to start a new table after so many rows?  I guess if it only prints exactly whats on the screen I'll need to build a printable report as a separate option.
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
Yes, unfortunately, AFAIK there are no commands to control how it is printed out.  It just prints exactly what's on the screen.
So if you can get the screen to look how you wanted it printed then you're in business.

Unfortuantely I know no ASP or ActiveX, so I can't help with that, but any html/javascript issues you have with this question I can assist you with.

Also you bring up a question about controling page breaks, and this is a question asked in the past, and the conclusion is always that there is no good way to do it, but ways to try and enforce it.  It can get kind of complex, and I haven't played with this, but I know others on EE have, so maybe they can help with that.

Good luck!
-josh
0
 

Author Comment

by:ehst
Comment Utility
Thanks for your help.  If anyone else has ideas let me know.
0
 

Expert Comment

by:avla
Comment Utility
On the risk of speaking just to speak, I think formatting the page to the printer is almost next to impossible unless you format the html page to the way that you want it to look. On an abstract level, you can change and filter anything between the person's computer and the server. But the printer is on the other  side. Security is a big issue regarding that. Allowing access to someone's printer is dangerous. ActiveX allows you to do some stuff on that side, since the person allows some access to their computer. But I haven't heard of anyway to do it with that either. This is just from my experience and would like to know otherwise.

Does ActiveX allow you to send text to a stream or an object that can still be sent to the printer? Again, I think security might limit you on that one.

a.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Expert Comment

by:Patricia080698
Comment Utility
I would suggest using hjorizontal frames. 3 of them. A small one at the top for your header, the middle frame,where all your information is, and another small one at the bottom, for your footer. this will work.
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
Browsers only print the currently active frame.  At least this has been my experience (I don't do much printing from web pages).  So how would this do what he asks?
-Josh
0
 

Author Comment

by:ehst
Comment Utility
Yeah, I don't see how this will work.  Even if you choose to print all frames, will the top and bottom frames get reprinted with the text in the middle frame that doesn't fit on the first page?
0
 
LVL 1

Accepted Solution

by:
alweiner earned 150 total points
Comment Utility
Wrong approach.  If the purpose of the page is to generate a report on a user's printer, generate the output as a PDF file and let the user download (and print) that.  You have total control over the output from a PDF file...
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
That is a good suggestion alweiner.  I agree.  If you want to control the output of a printed report generate it in another format and make downloadable.  You could pdf which can be plugged into the browser or you could use something like word.
-Josh
0
 

Expert Comment

by:AnitaP
Comment Utility
jbirk : Internet Explorer prints out what you see on your screen. That means all of the frames. Please do not reject my answer without knowing exactly what I mean. If you do not know how all you have to do is comment it
0
 

Expert Comment

by:AnitaP
Comment Utility
what patricia said is true. Internet explorer prints all of the frames. It give you the choice to print whatever you want.
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
So how that work with frames that have scroll bars?
Does it just print the visible part at that time?
As you can probably tell, I'm a netscape user...
-Josh
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now