[reportlab-users] TableStyle Alternating the background color

g.costanzi at email.it g.costanzi at email.it
Sat Jul 11 11:28:33 EDT 2009




Perfect!

Thank you very much.

--

Giuseppe

Errare è umano, ma per fare veramente casino ci vuole la password di
root...





--------- Original Message --------

Da: "Dinu Gherman" <gherman at darwin.in-berlin.de>

To: "Support list for users of Reportlab software"
<reportlab-users at reportlab.com>

Oggetto: Re: [reportlab-users] TableStyle Alternating the background color

Data: 10/07/09 08:25







g.costanzi at email.it:



> How can assign ,in run time, a different colour to the rows of a

> table when I set the TableStile?

> I use a recordset extract from SQLite and depending on a value of a

> record field, I would like to set a different color.

> My code,rs is the recordset,if the Price value is > 5000 the I
would

> like

> to change color in red.





You look at the data and set the style of the appropriate row

accordingly, something like this (untested):



...

tab_sty = [...]

for i, row in enumerate(rs):

if row[*some_index*] > 5000:

tab_sty.append(("BACKGROUND", (0,i),(-1,i), colors.red))

t.setStyle(TableStyle(tab_sty))

...



Regards,



Dinu



......................................................................

Follow me on Twitter: http://twitter.com/dinugherman





--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
autenticato? GRATIS solo con Email.it: http://www.email.it/f

Sponsor:
Scegli Riccione Family Hotels per le vacanze con i tuoi bambini! Il meglio
dell’offerta per famiglie, il massimo confort,prezzi vantaggiosi.
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=9307&d=20090711

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20090711/823ac7f0/attachment.htm>


More information about the reportlab-users mailing list