Solved

Repeating Column Headers when printing a table

Posted on 1998-09-16
15
336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
  • +3
15 Comments
 
LVL 8

Expert Comment

by:jbirk
ID: 1837803
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
ID: 1837804
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
ID: 1837805
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
Industry Leaders: 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!

 

Author Comment

by:ehst
ID: 1837806
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
ID: 1837807
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
ID: 1837808
Thanks for your help.  If anyone else has ideas let me know.
0
 

Expert Comment

by:avla
ID: 1837809
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
 
LVL 1

Expert Comment

by:Patricia080698
ID: 1837810
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
ID: 1837811
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
ID: 1837812
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
ID: 1837813
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
ID: 1837814
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
ID: 1837815
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
ID: 1837816
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
ID: 1837817
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

726 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