[reportlab-users] Border style for tables

Robin Becker robin at reportlab.com
Wed May 4 12:47:56 EDT 2011


On 04/05/2011 13:41, Arkadi Colson wrote:

> Hi

>

> One small question:

> Is it possible to use a dotted border style for tables in reportlab?

>

> Thanks!

>

> Best regards,

> Arkadi


yes see the example below

######################################################
from reportlab.platypus.tables import Table, TableStyle
from reportlab.lib import colors

doc = SimpleDocTemplate('ttab.pdf', showBoundary=1)
t = Table((('','North','South','East','West'),
('Quarter 1',100,200,300,400),
('Quarter 2',100,400,600,800),
('Total',300,600,900,'1,200')),
(72,36,36,36,36),
(24, 16,16,18)
)
#line commands are like
#op, start, stop, weight, colour, cap, dashes, join, linecount, linespacing
t.setStyle(
TableStyle([
('GRID', (1,1), (-2,-2), 0.25, colors.red),
('BOX', (0,0), (-1,-1), 0.25, colors.blue, None, (2,2,1)),
])
)
story = [t]
doc.build(story)
######################################################
--
Robin Becker


More information about the reportlab-users mailing list