Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Tables for Printing

Status
Not open for further replies.
Mar 14, 2002
711
US
I have 2 tables displayed on an HTML page, each table has 10 columns and the rows can vary between 3-40, depending on the query results. My problem is that I want to format the page so that each printed page, 8.5x11", will look "nice" when printed, i.e. the table is not cut off at the end of each page and that it looks neat. Has anyone been able to accomplish this using regular HTML tables?

BTW, I am using Visual Interdev as my source editor, most of the code is handwritten.

Thanks,
 
Try using CSS to force or prevent a page break at a certain location. Unfortunately, this tag is not supported by all browsers at this time. Here's more info on this topic:


-Ron

-We all play from the same deck of cards, it's how we play the hand we are dealt which makes us who we are.
 
The only serious way to accomplish this task is to use PDF for the printable format. Now, to answer your question:

"Has anyone been able to accomplish this using regular HTML tables?"

Yes, this can be done. First, keep in mind that no matter how you format your table, the print output really depends on the Page Setup in the client browser. You won't know if a client browser has 0.5 or 1.25 inches of left/top/right/bottom margins. Some users may have their browser print headings and/or footers which may contain the URL or page number.
The only solution I can think of, if you really want to do it in plain HTML, is to create an onLoad eventhandler for your printable HTML that displays a message to the client user. This way, you can give page setting instructions to assure control of the output. But your job does not end here. Simple table formatting won't look the same in IE and Netscape. You may have to create a cross-browser table formatting (check this out: faq215-4499)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top