[reportlab-users] Table, SPAN and splitlast
brich at caseta.com
Tue Feb 19 11:58:06 EST 2008
Thank you Robin. On that same note then however, is there a way to get
the last row of the table to have a background? Much like the
previously talked about issue, I want to have the last row of a table
have a grey background, but when the table spans over two pages, the
grey background is placed on the last row of the previous page, as well
as the last row of the end of the table. Any suggestions?
From: reportlab-users-bounces at reportlab.com
[mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Robin Becker
Sent: Tuesday, February 19, 2008 10:49 AM
To: Support list for users of Reportlab software
Subject: Re: [reportlab-users] Table, SPAN and splitlast
Brandon Rich wrote:
> Also, was there ever a resolution to this problem? I have run into
> same issue but have not found an answer to it
>>> I'm new to Reportlab and I tried a draw a simple table with 3
>>> and I want the last row to be SPANned over the 3 cols.
>>> So I first added ('SPAN', (-1, 0), (-1,-1)) to the table style, but
>>> discovered that if the table was split over multiple pages, the last
>>> row of each page was spanned...
>>> After looking in the manuals I found that I could use 'splitlast' so
>>> I changed the style to
>>> ('SPAN', (0, 'splitlast'), (-1, 'splitlast')) and got an error whose
>>> traceback ends with
>>> File "C:\Python24\lib\site-packages\reportlab\platypus\tables.py",
>>> line 763, in _calcSpanRanges
>>> for y in xrange(y0, y1+1):
>>> TypeError: cannot concatenate 'str' and 'int' objects
>>> Can you help me with that ?
>> Read the doc: "In any style command the first row index may be set
>> to one of the special strings 'splitlast' or 'splitfirst' ..."
>> You're setting BOTH the first and second row indices to 'splitlast'.
>> I believe you want this:
>> ('SPAN', (0,'splitlast'), (-1,-1))
> Same error with this syntax. :-(
> When I first tried with ('SPAN', (0, 'splitlast'), (-1, 'splitlast'))
> was done after an example found in the distribution :
> where you can find : ('LINEBELOW', (0,'splitlast'),
> (-1,'splitlast'), 1, colors.white,'butt')
yes well a line is not the same as a span. The problem here is that the
splitlast row is always in the first table and the -1 element will
always be in
the second (assuming that a split occurs). If a split doesn't occur
not relevant if it does the span is impossible. I don't think we can do
determination of splitlast before the spans are calculated and making a
function of splitlast is liable to cause some major headaches.
reportlab-users mailing list
reportlab-users at reportlab.com
More information about the reportlab-users