[reportlab-users] small bug in setting tablestyle ???
Tim Roberts
timr at probo.com
Wed Feb 4 14:12:19 EST 2009
James Yoo wrote:
>
> disclaimer: I'm new to both python AND reportlab
> ...
> Nevertheless, here's the scenario:
> 1) I am dynamically creating a list of lists to feed to platypus.Table
> and also conditionally setting table styles on a cell by cell basis...
> ...
> 2) if you happen to be setting style for a single cell in the last
> column data[0][1]
>
> eg: TableStyle.add('FONT', (1,0),(1,0), 'Times-Bold')
>
> tables._addCommand does this test to calculate the cell coords for the
> style:
>
> 873 else:
> 874 (op, (sc, sr), (ec, er)), values = cmd[:3] , cmd[3:]
> 875 if sc < 0: sc = sc + self._ncols
> 876 if ec < 0: ec = ec + self._ncols
> 877 if sr < 0: sr = sr + self._nrows
> 878 if er < 0: er = er + self._nrows
> * 879 for i in range(sr, er+1):
> * *880* * for j in range(sc, ec+1):*
> 881 _setCellStyle(self._cellStyles, i, j, op,
> values)
>
> you'll get a list index out of range error because of the the range()
> in line 880
Does it? Remember that a Python range is exclusive of the endpoint.
That is, range(0,1) returns one thing: 0.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the reportlab-users
mailing list