[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

Repeating Column Headers when printing a table

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
ehst
Asked:
ehst
  • 6
  • 4
  • 2
  • +3
1 Solution
 
jbirkCommented:
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
 
ehstAuthor Commented:
Right.  I just want to be able to print a hard copy of the report with the headings showing up on every page.  
0
 
jbirkCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ehstAuthor Commented:
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
 
jbirkCommented:
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
 
ehstAuthor Commented:
Thanks for your help.  If anyone else has ideas let me know.
0
 
avlaCommented:
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
 
Patricia080698Commented:
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
 
jbirkCommented:
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
 
ehstAuthor Commented:
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
 
alweinerCommented:
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
 
jbirkCommented:
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
 
AnitaPCommented:
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
 
AnitaPCommented:
what patricia said is true. Internet explorer prints all of the frames. It give you the choice to print whatever you want.
0
 
jbirkCommented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 4
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now