Question

HTML table tag and printing

Asked by: aguldber

Everyone here knows the joys of printing on the web. I'm sure this will add to that saga...

Here's some background info: I am generating a financial report on our Intranet (IE 4.01 is our browser client, IIS 4 web server) and they would like to obviously like to view this report on their screen (assume 17" monitor 800x600 video mode) and also be able to print it in landscape mode on a standard sheet of paper. This report would be generated on the fly from an ASP file which I am creating to pull data from an Oracle database to create the report.

Through some experimentation I have found that an 8pt font-size is probably the limit of readability for Screen viewing, while we could go down to 7pt font-size for printed viewing.  

The problem is that this report is considerably wider than one screen width (using an 8pt font-size) so I am limited to defining the table by pixels instead of a percentage of the screen. If I use a style sheet to change the font-size based on the media (Print or Screen) the font-size changes but the table dimensions stay the same. Since the table width in pixels is longer than one landscape printed page and does not adjust with the different media, I can't take advantage of the reduced font-size to have more of the report printed on that page.

How do I fulfill this printing need?

The HTML code that I have for this report is below:

<html>

<head>
<title>Brenda Pashak's Complex Report</title>
<style type="text/css" media="Print">
BODY {font-size: 8pt}
.smallprint {font-size: 8pt}
</style>
<style type="text/css" media="Screen">
BODY {font-size: 8pt}
.smallprint {font-size: 8pt}
</style>
</head>

<body>
<div align="left">

<table border="1" cellpadding="0" width="1300" cellspacing="0" class="smallprint">
  <tr>
    <td colspan="10" width="425" align="center"><p align="center">Current Month</td>
    <td width="180" rowspan="4">&nbsp;</td>
    <td colspan="12" width="527" align="center"><p align="center">Year-to-Date</td>
  </tr>
  <tr>
    <td colspan="4" width="194" align="center"><p align="center">at Actual Exchange Rates</td>
    <td colspan="4" width="156" align="center"><p align="center">at Budgeted Exchange Rates</td>
    <td colspan="2" width="63" align="center"><p align="center">Variance due to Currency</td>
    <td colspan="4" width="139" align="center"><p align="center">at Actual Exchange Rates</td>
    <td colspan="4" width="175" align="center"><p align="center">at Budgeted Exchange Rates</td>
    <td colspan="2" width="73" align="center"><p align="center">Variance due to Currency</td>
    <td colspan="2" width="122" align="center"><p align="center">% Change from Prior YTD</td>
  </tr>
  <tr>
    <td width="107" colspan="2" align="center">&nbsp;</td>
    <td colspan="2" width="75" align="center"><p align="center">Variance</td>
    <td width="87" colspan="2" align="center">&nbsp;</td>
    <td colspan="2" width="57" align="center"><p align="center">Variance</td>
    <td width="57" colspan="2" align="center">&nbsp;</td>
    <td width="71" colspan="2" align="center">&nbsp;</td>
    <td colspan="2" width="56" align="center"><p align="center">Variance</td>
    <td width="85" colspan="2" align="center">&nbsp;</td>
    <td colspan="2" width="78" align="center"><p align="center">Variance</td>
    <td colspan="2" width="73" align="center">&nbsp;</td>
    <td colspan="2" width="122" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td width="56" align="center"><p align="center">Actual <br>
    USD</td>
    <td width="51" align="center"><p align="center">% of <br>
    Sales</td>
    <td width="55" align="center"><p align="center">USD</td>
    <td width="17" align="center"><p align="center">%</td>
    <td width="47" align="center"><p align="center">Actual <br>
    USD</td>
    <td width="40" align="center"><p align="center">% of <br>
    Sales</td>
    <td width="36" align="center"><p align="center">USD</td>
    <td width="15" align="center"><p align="center">%</td>
    <td width="46" align="center"><p align="center">USD</td>
    <td width="11" align="center"><p align="center">%</td>
    <td width="32" align="center"><p align="center">Actual <br>
    USD</td>
    <td width="39" align="center"><p align="center">% of <br>
    Sales</td>
    <td width="35" align="center"><p align="center">USD</td>
    <td width="15" align="center"><p align="center">%</td>
    <td width="46" align="center"><p align="center">Actual <br>
    USD</td>
    <td width="39" align="center"><p align="center">% of <br>
    Sales</td>
    <td width="33" align="center"><p align="center">USD</td>
    <td width="39" align="center"><p align="center">% of <br>
    Sales</td>
    <td width="46" align="center"><p align="center">USD</td>
    <td width="21" align="center"><p align="center">%</td>
    <td width="56" align="center"><p align="center">as <br>
    reported</td>
    <td width="60" align="center"><p align="center">at Current <br>
    Year BER</td>
  </tr>
  <tr>
    <td align="right" width="56">xx,xxx.x</td>
    <td align="right" width="51">xx.x%</td>
    <td align="right" width="55">xx,xxx.x</td>
    <td align="right" width="17">xx.x%</td>
    <td align="right" width="47">xx,xxx.x</td>
    <td align="right" width="40">xx.x%</td>
    <td align="right" width="36">xx,xxx.x</td>
    <td align="right" width="15">xx.x%</td>
    <td align="right" width="46">xx,xxx.x</td>
    <td align="right" width="11">xx.x%</td>
    <td align="right" width="180"><p align="left">_Business Operating Fixed Expense_</td>
    <td align="right" width="32">xx,xxx.x</td>
    <td align="right" width="39">xx.x%</td>
    <td align="right" width="35">xx,xxx.x</td>
    <td align="right" width="15">xx.x%</td>
    <td align="right" width="46">xx,xxx.x</td>
    <td align="right" width="39">xx.x%</td>
    <td align="right" width="33">xx,xxx.x</td>
    <td align="right" width="39">xx.x%</td>
    <td align="right" width="46">xx,xxx.x</td>
    <td align="right" width="21">xx.x%</td>
    <td align="right" width="56">xx.x%</td>
    <td align="right" width="60">xx.x%</td>
  </tr>
  <tr>
    <td width="56" align="right">xxx,xxx.x</td>
    <td width="51" align="right">100.00%</td>
    <td width="55" align="right">xxx,xxx.x</td>
    <td width="17" align="right">xxx.x%</td>
    <td width="47" align="right">xxx,xxx,x</td>
    <td width="40" align="right">100.00%</td>
    <td width="36" align="right">xxx,xxx.x</td>
    <td width="15" align="right">xxx.x%</td>
    <td width="46" align="right">xxx,xxx.x</td>
    <td width="11" align="right">xxx.x%</td>
    <td width="180" align="right"><p align="left">_Business Operating Fixed Expense_</td>
    <td width="32" align="right">x,xxx,xxx.x</td>
    <td width="39" align="right">100.00%</td>
    <td width="35" align="right">xxx,xxx.x</td>
    <td width="15" align="right">xxx.x%</td>
    <td width="46" align="right">x,xxx,xxx.x</td>
    <td width="39" align="right">100.00%</td>
    <td width="33" align="right">xxx,xxx.x</td>
    <td width="39" align="right">xxx.x%</td>
    <td width="46" align="right">xxx,xxx.x</td>
    <td width="21" align="right">xxx.x%</td>
    <td width="56" align="right">xxx.x%</td>
    <td width="60" align="right">xxx.x%</td>
  </tr>
</table>
</div>
</body>
</html>
 

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
1999-05-18 at 13:51:38ID10162323
Tags

landscape

Topic

Web Authoring

Participating Experts
4
Points
200
Comments
19

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. font control in CSS
    What's the best way to control leading and kerning using CSS? Is it using the letter spacing and line-height options? What does the vertical-align option do? What the browser incompatibility issues, if any, with these? Have you got an URLs showing advanced font control exam...
  2. Div tags and CSS
    I am trying to change the font family and font size in a dropdown box that is located in between div tags. I am doing this through a external CSS and the problem is IE. The font will not change in IE but it changes in Netscape for what is the div tags namely the text within...
  3. <Select tag and Div
    I have a div that allows users to pick a date, this is movable but other select tags on the form always show through my DIV. How can i ensure the div is always at the very top? Here is the HTML page, there are a few references to other files but the date stuff should work i...
  4. Div tag to ignore css outside of div tag?
    Is there a way that I can do a div tag so that any css outside of the div tag is ignored? For example: --------------- <div id="selfcontained" style="no css outside this tag influences items inside this tag"> some css, text, etc, will go here &...
  5. Simple Menu using CSS and DIV tags
    Hi Experts The code below shows a simple menu using CSS and DIV tags. When you mouseover a link, a slide out menu appears. What I want to do is when you mouseover a link e.g. LINK THREE, then mouseover item 4 within LINK THREE another slide out menu appears to the side of ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: kschangPosted on 1999-05-18 at 15:23:53ID: 1862436

I hate to suggest the obvious, but can't you do "to print, click here", then show them the "print-optimized" version for printing? After all, that's what WIRED.COM, Lycos Roadmap, and various other big websites do...

 

by: MasseyMPosted on 1999-05-18 at 18:56:58ID: 1862437

Also, why not just create a Word Document from your source?  Since you know it is going to be in an IE browser, you can open it in word and printing will be easy.

 

by: aguldberPosted on 1999-05-19 at 06:08:27ID: 1862438

In response to kschang: That had crossed my mind. I was hoping to provide both options on one coded page, but am wondering if that is even possible with today's technologies. That may end up being my fallback plan.

In response to MasseyM: Interesting Thought. If the data from these reports wasn't as dynamic as it is (data in the database is updated at least 2 times a day - I appoligize for not meantioning that) I might agree with you on porting it over to Word or even Excel to take advantage of the 'fit on a page' print option. Unfortunately, my knowledge of VBA isn't very high and the fact that we are still using Office 95 limits what I can do for this type of solution. Plus, my users are looking more for a browser solution instead of an Office solution.

 

by: TTomPosted on 1999-05-19 at 09:18:40ID: 1862439

Picking up on Matt's suggestion, I presume the page is running some sort of stored procedure to gather the data as needed.  If that is the case, could you write a procedure to export the data to some form usable by Word?  If it were an Access database (YUK!), it could be done directly.  However, once the export file has been created, it shouldn't be terribly difficult to import it as a link to a Word doc.  Shouldn't really require any VBA.

You could still then run the process and open the Word doc from inside the browser.  It would really be an 'integrated' solution.

Matt, what do you say?  Would be kind of like porting the data over on the fly, no?

Please feel free to ignore this, as it just sounded like an interesting possibility to me.

Tom (:-}

 

by: aguldberPosted on 1999-05-19 at 09:41:10ID: 1862440

Here's some more info on the inner workings of the ASP code I will be generating:

The database that I am using to generate these report is Oracle. It is using stored procedures to come up with this report. We have two tables, one table has the data, the other table acts like a report map and tells you how to build various reports. For example, if you want to create a Balance Sheet, there'a a column in the report_map table that is called report type. You can pass the report type to the stored procedure and have the report_map drive the generation of the report. If there are any changes with the report, you change the database, instead of the code.

I'll let this Word discussion continue, b/c it has peeked my interest has well. Depending on how it goes, I may have to fall back to kschang's recommendation.


 

by: MasseyMPosted on 1999-05-19 at 11:36:44ID: 1862441

Just for kicks, put this at the top of one of your ASP pages and run it.  It should open Excel within the browser and then format your document for you.

<%
Response.ContentType = "application/vnd.ms-excel"
Response.Buffer = TRUE
%>

 

by: aguldberPosted on 1999-05-19 at 12:14:53ID: 1862442

Actually, it prompts me to download the file test.asp and it opens up Visual InterDev.

I don't believe I am doing anything wrong with my test file. Have a look for yourself:

<%@ Language=VBScript %>

<%
Response.ContentType = "application/vnd.ms-excel"
Response.Buffer = TRUE
%>
<html>

<head>
<title>Sample Report Format</title>
</head>

<body>
 <DIV>
  <table border="0" cellpadding="0" width="100" cellspacing="0">
   <tr>
    <td width="50" align= "left" valign= "center">REPORT </td>
    <td width="50" align="middle" valign "center">Data</td>
   </tr>
  </table>
 </DIV>
</body>

</html>

 

by: MasseyMPosted on 1999-05-19 at 13:03:50ID: 1862443

That is weird.  The problem I believe you are encountering has to do with the version of Excel you are using.  Is it 97 or 95?


 

by: aguldberPosted on 1999-05-19 at 13:07:00ID: 1862444

Excel 95 even though I have the web wizard add-on

 

by: aguldberPosted on 1999-05-19 at 13:07:52ID: 1862445

I'll try this at home tonight (where I have Excel 97) and see if I have the same issue...

 

by: MasseyMPosted on 1999-05-19 at 13:21:14ID: 1862446

You should be able to say open it and it will open in Excel within the browser.

I will come up with another way tonight.

 

by: johnny99Posted on 1999-05-19 at 22:28:28ID: 1862447

I'm not sure what your question *is* exactly, but if I understand you correctly, you want this report to print out nicely as two landscape-format pages?

If that's the case, you just need to split it into two tables.

Even if that's not the case, all the solutions above are complex and non-HTML-centric.

Here's the solution to forcing any table to a certain size:

Put a transparent gif or any other image into a row of the table, and set the width of the whole table to something impossibly small.

For instance, if you want to force it to fit into the 800-pixel window size, then put a 750-pixel long transparent gif into the top row, <TD colspan=(however many you need)>, then set the table width to 10% or something, and it will 'shrink-wrap' to the size of the gif. Any cells inside it can be handled the same way.

That's the way to do it in the HTML anyway. Feel free to reject this answer, but do try and take the time to spell out exactly what you want from the HTML, and I'm sure there's a less complex solution.

 

by: aguldberPosted on 1999-05-20 at 07:14:59ID: 1862448

Not sure I understand what you are doing. In answer to your question: My question is how do I make this complex report print on a single page width.

Here's what's been come up with so far:

1.) Johnney99 talked about splitting the report is an option so that you don't have to worry about maintaining two different flavors of the same report (screen vs print). Unfortunately my users want all that info together, so that won't work.

2.) There is the kschang (Wired.com) approach of having a display version, and provide a hyperlink for a print version. I have been spending some time trying to come up with a print version while this discussion has taken place and have yet to succeed on making this report print on one page.

3.) Then there's MasseyM's approach of adding code to open Excel and have Excel do the formatting for you and take advantage of the 'Fit on a Page' printer option. This works for Excel 97 - I confirmed it this morning, but unfortunately we have Office 95 where this is going to be used.

That's where we are to date.

 

by: MasseyMPosted on 1999-05-20 at 11:53:54ID: 1862449

I have another idea.  I think we can create the Word or Excel doc on the server and then send tht doc to the browser... I will post the code as soon as I get a little time.

 

by: johnny99Posted on 1999-05-20 at 15:12:24ID: 1862450

Hi,

you've misrepresented me a little, I didn't say make two versions, one screen and one print, I said fix it so it splits neatly across page breaks and prints on two pages.

Then I said there's a solution to what *appears* to be your problem, i.e. getting the table to shrink to a certain size, and believe me my solution would have worked...I'll do it when I have a moment...

 

by: johnny99Posted on 1999-05-20 at 23:28:18ID: 1862451

please go to http://www.99design.com.au/brenda and see what I've done with your tables...

 

by: aguldberPosted on 1999-05-21 at 06:57:51ID: 1862452

Johnny99,
I appoligize for misrepresenting your proposed solution. I didn't mean to discount your solution, I couldn't visualize exactly what you were doing and I wanted to leave the door open to MasseyM because he was talking about something that I can leverage in January when we upgrade to Office 2000 - but I have to have this working by July so that doesn't help me today. Anyway, with the example you have provided me I now have a pretty good idea what you were talking about and I like what you have done.

I have a couple of questions on your HTML code for the single report page . What's the significants of the table width = 10%. Is that just an arbitrary number? I also noticed on that page that you set the spacer graphic to 750. I assume you are using that to set the actual width of the table. Is that a correct assumption?

If you answer me these questions, I will accept this proposed answer.

 

by: johnny99Posted on 1999-05-21 at 15:40:31ID: 1862453

Yeah, as I said above in the rejected answer, the only way to really force a table to a certain width, with the vagaries of HTML, is to

     * put an image in it x number of pixels wide, then
     * set the table width to an impossible small percentage so that no matter how big the window is it will always be forced to the image size.

HTML tables basically make up their own minds if you don't do this, they're very unpredictable.

This is called shrink-wrapping. I learned it from the web design guru Jeff Glover (http://www.jeffglover.com/).

The nuber 750 was derived from the following reasoning:

     * a piece of A4 is 297mm long,
     * at 72 d.p.i that's 842 pixels
     * take away 10 per cent for borders and round down

Isn't web publishing fun?

 

by: aguldberPosted on 1999-05-25 at 05:36:14ID: 1862454

Thanks...

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...