[reportlab-users] determination of number of column in a table.

Bryan Muir reportlab-users@reportlab.com
14 Feb 2003 15:01:27 -0500


Big surprise, I have a table that is made up of rows and cols.  

The cols can be in any arbitrary order as they are configured by the
user. I can generate the table fine, but often times it has more columns
than will fir on a page.  So I am in the process of implementing a
procedure to only show the number of columns that will fot on a page.

I figured out how to make the table calculate the sizes of the rows, but
I was wondering what was the best way to calculate the number of cols.

Currently, just prior to appending the table to the story, I am grabbing
the current page size, subtracting my standard margins, and then looping
over the column widths of the table and adding them up.  When I run out
of space, I now how many cols I can use.

My question is, is there a better way of determining this information? 
Like a switch to tell the SimpleDocTemplate to ignore extra cols?

If not, does anyone else have source code that implements something
similiar that I can look at?


-- 
Bryan Muir <bmuir@eyrie.gsfc.nasa.gov>