I am in my way of creating an invoices web app with django
. I use reportlab
to generate pdf invoices. I've done everything but the client wants to remove the grid from rows inside the table, I try to colorize them with white but I got this result in image
this is my code of table:
def myTable(tabledata):
colwidths = (60, 320, 60, 60)
t = Table(tabledata, colwidths)
t.hAlign = 'RIGHT'
GRID_STYLE = TableStyle(
[
('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black),
('BOX', (0, 0), (-1, -1), 0.25, colors.black),
('LINEABOVE', (0,1), (-1,-1), 0.25, colors.white),
]
)
t.setStyle(GRID_STYLE)
return t
One way is to use color.hexcolor() and use a transparent color. Transparent white would be:
colors.HexColor('#00FFFFFF')
Here is what your code would look like with the internal grid set to transparent:
def myTable(tabledata):
colwidths = (60, 320, 60, 60)
t = Table(tabledata, colwidths)
t.hAlign = 'RIGHT'
GRID_STYLE = TableStyle(
[
('INNERGRID', (0, 0), (-1, -1), 0.25, colors.HexColor('#00FFFFFF')),
('BOX', (0, 0), (-1, -1), 0.25, colors.black),
]
)
t.setStyle(GRID_STYLE)
return t
if you want to keep the column dividers:
def myTable(tabledata):
colwidths = (60, 320, 60, 60)
t = Table(tabledata, colwidths)
t.hAlign = 'RIGHT'
GRID_STYLE = TableStyle(
[
('INNERGRID', (0, 0), (-1, -1), 0.25, colors.HexColor('#00FFFFFF')),
('BOX', (0, 0), (-1, -1), 0.25, colors.black),
('LINEAFTER', (0,0), (-1,-1), 0.25, colors.black),
]
)
t.setStyle(GRID_STYLE)
return t
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.