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.
Main Topics
Browse All TopicsEveryone 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"> </td>
<td colspan="12" width="527" align="center"><p align="center">Year-to-Dat
</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"> </td>
<td colspan="2" width="75" align="center"><p align="center">Variance</t
<td width="87" colspan="2" align="center"> </td>
<td colspan="2" width="57" align="center"><p align="center">Variance</t
<td width="57" colspan="2" align="center"> </td>
<td width="71" colspan="2" align="center"> </td>
<td colspan="2" width="56" align="center"><p align="center">Variance</t
<td width="85" colspan="2" align="center"> </td>
<td colspan="2" width="78" align="center"><p align="center">Variance</t
<td colspan="2" width="73" align="center"> </td>
<td colspan="2" width="122" align="center"> </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</t
<td width="51" align="right">100.00%</td>
<td width="55" align="right">xxx,xxx.x</t
<td width="17" align="right">xxx.x%</td>
<td width="47" align="right">xxx,xxx,x</t
<td width="40" align="right">100.00%</td>
<td width="36" align="right">xxx,xxx.x</t
<td width="15" align="right">xxx.x%</td>
<td width="46" align="right">xxx,xxx.x</t
<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 width="39" align="right">100.00%</td>
<td width="35" align="right">xxx,xxx.x</t
<td width="15" align="right">xxx.x%</td>
<td width="46" align="right">x,xxx,xxx.x<
<td width="39" align="right">100.00%</td>
<td width="33" align="right">xxx,xxx.x</t
<td width="39" align="right">xxx.x%</td>
<td width="46" align="right">xxx,xxx.x</t
<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.
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.
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.
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.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
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.
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.
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 (:-}
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.
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>
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.
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.
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...
please go to http://www.99design.com.au
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.
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?
Business Accounts
Answer for Membership
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...