Forum Moderators: open

Message Too Old, No Replies

Dynamically Printing Wide Tables

         

jenwen

2:23 pm on May 5, 2005 (gmt 0)

10+ Year Member



I'd like to hear any best practices or suggestions for printing wide tables. I'm in Cold Fusion 5 (the client is on MX), if that helps. I have disgustingly wide tables that they want to print, but they roll off the page when printed. I'm not finding much out there so far on this issue. I'd ideally like to be able to give them a choice of 8.5X11 or 8.5X14, landscape or portrait, and configure the data to break appropriately and roll to a subsequent page.

TIA

Jen

StupidScript

10:55 pm on May 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there one particular column that is so wide it can't print on a single page, or are there so many columns that they can't print on a single page?

There's a CSS2 set of instructions for handling this, but they are highly browser-dependent and results may vary. You got a tricky problem, alright.

See "Paged Media" on the W3C site [w3.org] for details.

jenwen

3:46 am on May 6, 2005 (gmt 0)

10+ Year Member



There are 22 columns. A little overkill.. but the client knows best I guess. I was reading the CSS2 instructions, but it sounds really complicated. The only answer I've come up with so far is to run a report which splits the table into three consecutive reports, each with 1/3 of the columns. Not very slick.

Jen

jenwen

3:57 am on May 6, 2005 (gmt 0)

10+ Year Member



The only good thing is the client is restricted to IE6. So as long as it works in IE6, I'm fine.

Jen

StupidScript

6:27 pm on May 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What you're looking at in the CSS2 docs is basically to set the orientation and size of the page, and then you must let the browser interpret that ... for better or worse.

@page {

size: 11in 8.5in; /* width height */

margin: 10%;

}

or

@page {

size: landscape; /* auto is default */

margin: 10%;

}

From the CSS2 docs:

If a page box does not fit the target sheet dimensions, the user agent may choose to:

Rotate the page box 90° if this will make the page box fit.
Scale the page to fit the target.

The user agent should consult the user before performing these operations.

Also see section 13.3 for info on page breaking, and thus starting a new page "box", like the ones described above.

These are implemented using standard CSS2 notation, i.e. inside a stylesheet. Once you have defined the parameters, it's completely up to the browser how it handles the instructions ... IF the browser can handle them.

I have used, for example, the "page-break-after" instructions to limit the printing of our company appointment calendar to two weeks per page by enclosing each week's table in an IDd DIV tag and dynamically writing the ID that includes the break in every second table's DIV container.

I suspect something similar may be appropriate for you.
The big question is whether IE6 knows how to deal with the

@page
rules.

StupidScript

7:44 pm on May 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The big question is whether IE6 knows how to deal with the @page rules.

And the answer is ... it doesn't.

Here's a more complete markup example from the CSS2 docs:

@page rotated {size: landscape}

TABLE {page: rotated}

Doesn't look like Firefox 1.0.2 supports the

@page
rules, either.

Time for fudge! :)