[reportlab-users] Zebra Stripes and the Table Flowable
shawn a
boris317 at gmail.com
Mon Jan 14 13:36:49 EST 2008
Robin, thanks.. that did the trick. Where can i find these sample scripts?
Thanks,
Shawn
On Jan 14, 2008 12:52 PM, Robin Becker <robin at reportlab.com> wrote:
>
> shawn a wrote:
> > Hello,
> >
> > I am looking for a way to give my table flowables a "zebra striping"
> > effect. I.E every other row is light gray.
> >
> > If i was drawing an HTML table i would simply do a
> > if(rowNum mod 2 == 0):change style
> >
> > It doesn't look like i can get that level of control during the table draw.
> > I'm sure someone has figured this out. Any insight would be greatly appreciated
> >
> > thanks,
> > -shawn
> .......there is a setting that does exactly this that does this. See
> test_platypus_tables.py
>
>
>
>
> ######################
> lst.append(Paragraph('Trying colour cycling in background',
> styleSheet['Heading1']))
> lst.append(Paragraph("This should alternate pale blue and uncolored by row",
> styleSheet['BodyText']))
> data= [['001', '01', '02', '03', '04', '05'],
> ['002', '01', '02', '03', '04', '05'],
> ['003', '01', '02', '03', '04', '05'],
> ['004', '01', '02', '03', '04', '05'],
> ['005', '01', '02', '03', '04', '05'],
> ['006', '01', '02', '03', '04', '05'],
> ['007', '01', '02', '03', '04', '05'],
> ['008', '01', '02', '03', '04', '05'],
> ['009', '01', '02', '03', '04', '05'],
> ['010', '01', '02', '03', '04', '05'],
>
> ]
> t=Table(data,style=[
> ('GRID',(0,0),(-1,-1),0.5,colors.grey),
> ('ROWBACKGROUNDS', (0, 0), (-1, -1), (0xD0D0FF, None)),
> ])
> lst.append(t)
> lst.append(Spacer(0,6))
> lst.append(Paragraph("And this should pale blue, pale pink and None by column",
> styleSheet['BodyText']))
> data= [['001', '01', '02', '03', '04', '05'],
> ['002', '01', '02', '03', '04', '05'],
> ['003', '01', '02', '03', '04', '05'],
> ['004', '01', '02', '03', '04', '05'],
> ['005', '01', '02', '03', '04', '05'],
> ['006', '01', '02', '03', '04', '05'],
> ['007', '01', '02', '03', '04', '05'],
> ['008', '01', '02', '03', '04', '05'],
> ['009', '01', '02', '03', '04', '05'],
> ['010', '01', '02', '03', '04', '05'],
>
> ]
> t=Table(data,style=[
> ('GRID',(0,0),(-1,-1),0.5,colors.grey),
> ('COLBACKGROUNDS', (0, 0), (-1, -1), (0xD0D0FF, 0xFFD0D0, None)),
> ])
> lst.append(t)
> ######################
> --
> Robin Becker
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>
More information about the reportlab-users
mailing list