[reportlab-users] Table computation

Derik Barclay reportlab-users@reportlab.com
Fri, 28 May 2004 09:08:57 -0400


Ok, I get it now. I've done something similar but for width. 

I already had a custom table class structure sitting in memory, which made 
things easier.
Basicaly I walked the table structure and placed the cell contents in to a 
Paragraph object and used the "breakLines" method to get the contents width 
(in your case give it a width and let it calculate the height). I went 
through each cell till I found the largest cell, for each column and made 
that the columns width.

Something similar could be done to calculate the height of each row.

Their may be a better way...This is the only one I found. Hope this helps!

On May 28, 2004 08:50 am, Ulrich Wisser wrote:
> Hi Derik,
>
> I use platypus. I did define a frame on my page (about 80% of the page
> height). In that frame I can put 52 single line entries. The table is
> not to exceed the frame. I must truncate the table summarize the
> remaining amount and display the total. All that in the frame.
> Should look like
>
> car        5$
> insurance  1$
> gas        2$
>
> other      7$
> -------------
> total     15$
>
>
> I think you get the idea. All other entries from my expenses list would
> be summarzed as "other".
>
> Ulrich
>
> > What layer are you using? pdfgen or platypus?
> > Are you talking about having the table span multiple pages or truncating
> > it at the end of one page?
> >
> > On May 28, 2004 04:31 am, Ulrich Wisser wrote:
> >>Hello,
> >>
> >>I still have trouble with my table layout. I need to cut my table, so it
> >>will only occupy one frame. I have a list of 100+ entries (description
> >>with amount). I need to dispaly a part of this list that fits into the
> >>frame. It should look like (list has n entries):
> >>
> >>		description#1   amount#1
> >>                 ...
> >>    		description#m   amount#m
> >>
> >>		remaining	sum(amount#m+1 ... amount#n)
> >>
> >>		total           sum(amount#1   ... amount#n)
> >>
> >>The problem is, description can be very long, in fact it maybe span 2 or
> >>three lines. How can I compute the table height, so I do not insert too
> >>many rows?
> >>
> >>Thanks
> >>
> >>Ulrich
> >>
> >>
> >>
> >>_______________________________________________
> >>reportlab-users mailing list
> >>reportlab-users@reportlab.com
> >>http://two.pairlist.net/mailman/listinfo/reportlab-users
>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users@reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users

-- 
Givex - http://www.givex.com/ 
Derik Barclay<dbarclay@givex.com>
+1 416 350 9660