RE: Breaking up table for printing (long)

2004-04-09 Thread Ian Skinner
I think you can do this with style sheets.

 
This is just off my head, and completely untested (I'm writing it into this email as I think of it).

 
What you want to do is create your panels as you want them to print them in div blocks.Then tell these div blocks to float left.What will happen is that if there is not enough room for the next div to fit to the right of the previous one, it will fall to below it in line.This works on the screen and on a printer.We did something like this for a telephone directory, we set the names into groups that would output in columns when printed.

 
Don't forget you can define a print style sheet with different properties then your screen.Makes it very easy to make your display look good both on screen and paper.

 
Some code snippets.
style media=print
div
{
 width: 8in;
 float: left;
}
/style

 
cfset sec = 1
div id=Panel1-#sec#
cfloop over data by dates
 OUTPUT RESULTS

 
 cfif Columns greater then 5
cfset sec = sec + 1

 
/div
div ID=Panel1-#sec#
 /cfif
/cfloop
/div

 
I'm sure this will take quite a bit of refinement, but hopefully it gets you started.If you need more specific help let me know.

 
--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

C code. C code run. Run code run. Please!
- Cynthia Dunning
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Breaking up table for printing (long)

2004-04-09 Thread Ian Skinner
OK, that was a bit more complex then I thought.Luckily I enjoy a challenge.Here is a prototype of the display that you want, but this could be a challenge to integrate with a query, I think using the array notation of a query may be the best way.Anyway here is some tested code.

cfloop from=1 to=3 index=panel

 
cfoutput
cfset sec = 0

 
cfloop from=1 to=100 step=5 index=data
cfset sec = sec + 1
cfset start = data
cfset end = start + 4

 
div id=Panel#panel#-#sec# style=margin-bottom: 1em;
 span style=width: 1.25in; font-weight:bold;Panel: #panel# Sec: #sec#/span
 cfloop from=#start# to=#end# index=result
span style=width: 1in; font-weight:bold;
DATE #Result#
/span
 /cfloop
 cfloop from=1 to=5 index=test
div id=row#test#
span style=width: 1.25in;Test #test#/span
cfloop from=#start# to=#end# index=result
 span style=width: 1in;
ABCDEF
 /span
/cfloop
/div
 /cfloop
/div

 
/cfloop

 
/cfoutput

 
/cfloop
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Breaking up table for printing (long)

2004-04-09 Thread Scott Brady
Original Message:
 From: Ian Skinner 

Thanks.I've actually figured out a solution.I spent an hour late yesterday developing a mathematical formula for how to display this data on my dry erase board (I felt like Good Will Hunting :) ).

I've since managed to get this working in ColdFusion, too :). 

Here's the basics:

The formula is:
recordNumber = c + (colsPerRow * (i-1)) + ((n-1) * numDates)

where
c 			= 	the column number in the table ( from 1 to colsPerRow )
colsPerRow		=	columns per row
i			=	number of the iteration through all of the dates (i.e., if there are 3 sets of dates, i will be from 1 to 3)
n			=	the row number in the table ( from 1 to the numTests )
numDates		=	the number of total dates (ListLen(datelist))
numIterations 		=	Ceiling(numDates / colsPerRow)
numTests		=	the number of tests [from a query]

Once you know that formula, you can do this (pseudo code):
1) Loop along the number of iterations (using i as the index)
2) Loop along the number of tests (using n as the index)
3) Loop along the colsPerRow (using c as the index)
4) If c = 1, then display the test name for that row [returned in a query] (using the above formula]
5) Then, display each result(getPanels.result[recordNumber])

This works and appears to work for all the values I've tested it with.Thank goodness. This has been a thorn in my side for a while now.

Thanks for the suggestions!

Scott
---
Scott Brady
http://www.scottbrady.net/
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Breaking up table for printing (long)

2004-04-08 Thread Nathan C. Smith
Check out the style sheet (CSS) extensions for printing.They helped me
format a document for page breaks and such.

table style=page-break-inside:avoid;page-break-before 

The above, as you can guess causes the table not to be broen where possible
and causes a page-break before the able is printed.

It isn't a report writer but it helps a lot.

-Nate

Nathan SmithMcKee, Voorhees  Sease, P.L.C.515.288.3667

So, any ideas? Does this even make sense?

Scott

---
Scott Brady
http://www.scottbrady.net/
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Breaking up table for printing (long)

2004-04-08 Thread Scott Brady
Original Message:
 From: Nathan C. Smith 
 Check out the style sheet (CSS) extensions for printing.They helped me
 format a document for page breaks and such.
 
 table style=page-break-inside:avoid;page-break-before 
 
 The above, as you can guess causes the table not to be broen where possible
 and causes a page-break before the able is printed.

If I'm reading the spec right, this isn't quite what I am looking for.

What I probably didn't make clear was that in this example:
(Example #2)
PANEL 1DATE1DATE2DATE3
Test1 result1result2result3
Test2 result6result7result8
Test3 result11result12result13
Test4 result16result17result18

PANEL 1DATE4DATE5
Test1 result4 result5
Test2 result9 result10
Test3 result14result15
Test4 result19result20

PANEL 2DATE1DATE2DATE3
Test5 result21result22result23
Test6 result26result27result28
Test7 result31result32result33
Test8 result36result37result38

PANEL 2DATE4DATE5
Test5 result24result25
Test6 result29result30
Test7 result34result35
Test8 result39result40

those are all on one page.(If I left it so that all 5 date columns were in the same row, it would spill out onto a page to the right -- something we want to avoid).Vertical page breaks are ok (and I already have code to handle that), but we want the layout on a page to look like the above so that we don't have horizontal page breaks.

Does that make any more sense?(I've struggled with this for a while, so I know it's hard to explain clearly.)

Scott

---
Scott Brady
http://www.scottbrady.net/
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Breaking up table for printing (long)

2004-04-08 Thread Nathan C. Smith
I see, sorry for the confusion.

 
If it were me I might try getting old school on this problem.Use a
non-proportional font, and get out my data-processing ruler that measures in
picas and points and then try to limit how many characters occur across the
page.

 
I was having the same problem on the reports I learned the printed CSS stuff
for.My ultimate solution was to limit the table widths and use a smaller
font.

 
Good luck.

 
-Nate

 
-Original Message-
From: Scott Brady [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 08, 2004 1:36 PM
To: CF-Talk
Subject: RE: Breaking up table for printing (long)

Original Message:
 From: Nathan C. Smith 
 Check out the style sheet (CSS) extensions for printing.They helped me
 format a document for page breaks and such.
 
 table style=page-break-inside:avoid;page-break-before 
 
 The above, as you can guess causes the table not to be broen where
possible
 and causes a page-break before the able is printed.

If I'm reading the spec right, this isn't quite what I am looking for.

What I probably didn't make clear was that in this example:
(Example #2)
PANEL 1DATE1DATE2DATE3
Test1 result1result2result3
Test2 result6result7result8
Test3 result11result12result13
Test4 result16result17result18

PANEL 1DATE4DATE5
Test1 result4 result5
Test2 result9 result10
Test3 result14result15
Test4 result19result20

PANEL 2DATE1DATE2DATE3
Test5 result21result22result23
Test6 result26result27result28
Test7 result31result32result33
Test8 result36result37result38

PANEL 2DATE4DATE5
Test5 result24result25
Test6 result29result30
Test7 result34result35
Test8 result39result40

those are all on one page.(If I left it so that all 5 date columns were in
the same row, it would spill out onto a page to the right -- something we
want to avoid).Vertical page breaks are ok (and I already have code to
handle that), but we want the layout on a page to look like the above so
that we don't have horizontal page breaks.

Does that make any more sense?(I've struggled with this for a while, so I
know it's hard to explain clearly.)

Scott

---
Scott Brady
http://www.scottbrady.net/ 
_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Breaking up table for printing (long)

2004-04-08 Thread Scott Brady
Original Message:
 From: Nathan C. Smith

 If it were me I might try getting old school on this problem.Use a
 non-proportional font, and get out my data-processing ruler that measures in
 picas and points and then try to limit how many characters occur across the
 page.


Unfortunately, they could conceivably have 100+ date columns, so that still becomes unworkable.What we're going to do for now (unless some savior comes up with a better solution) is to only allow them to print one panel at a time, which simplifies this a lot.

Thanks for trying. In some ways I'm glad 30 people didn't come back with a this is so obvious solution. :)

Scott
---
Scott Brady
http://www.scottbrady.net/
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]