[reportlab-users] small bug in setting tablestyle ???

James Yoo james.yoo at gmail.com
Wed Feb 4 14:59:30 EST 2009


Robin, Tim, honorable list members....

After I realized the fundamental error I was making in my claim
(amature!)...

I retraced my steps.

Turns out, I was stepping in it, in a big way, and walking all over the
carpet to boot....

I had a STATIC var set to a particular TableStyle in my module....
and was using it within my function thinking that I was getting a new copy
with each invocation...

so I was constantly adding new cellstyles between invocations to the same
TableStyle obj...

thanks for pointing me out...

- "that guy"



On Wed, Feb 4, 2009 at 1:12 PM, Tim Roberts <timr at probo.com> wrote:


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

>

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20090204/ed8c439c/attachment.html>


More information about the reportlab-users mailing list