[reportlab-users] Table, SPAN and splitlast

Robin Becker robin at reportlab.com
Tue Feb 19 11:48:45 EST 2008


Brandon Rich wrote:

> Also, was there ever a resolution to this problem? I have run into the

> same issue but have not found an answer to it

>

> Thanks

>

>

>>> I'm new to Reportlab and I tried a draw a simple table with 3 columns

>

>>> 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 I

>

>>> 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')) it

> was done after an example found in the distribution :

> reportlab/test/test_platypus_tables.py

> 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 splitlast is
not relevant if it does the span is impossible. I don't think we can do the
determination of splitlast before the spans are calculated and making a span a
function of splitlast is liable to cause some major headaches.


--
Robin Becker


More information about the reportlab-users mailing list