我在 Python 中有以下代码来使用 ReportLab 生成两个表。
有没有办法使用 ReportLab 将这两个表并排放置?
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter, inch
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle
doc = SimpleDocTemplate("simple_table_grid.pdf", pagesize=letter)
elements = []
data= [['00', '01', '02', '03', '04','10', '11', '12', '13', '14'],
['10', '11', '12', '13', '14', '10', '11', '12', '13', '14'],
['20', '21', '22', '23', '24', '10', '11', '12', '13', '14'],
['30', '31', '32', '33', '34', '10', '11', '12', '13', '14']]
t=Table(data,5*[0.3*inch], 4*[0.2*inch])
t.setStyle(TableStyle([
('BACKGROUND',(0,0),(4,0),colors.gray),
('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
('BOX', (0,0), (-1,-1), 0.25, colors.black),
]))
elements.append(t)
data= [['100', '01', '02', '03', '04'],
['10', '11', '12', '13', '14'],
['20', '21', '22', '23', '24'],
['30', '31', '32', '33', '34']]
t=Table(data,5*[0.3*inch], 4*[0.2*inch])
t.setStyle(TableStyle([
('BACKGROUND',(0,0),(4,0),colors.gray),
('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
('BOX', (0,0), (-1,-1), 0.25, colors.black),
]))
elements.append(t)
doc.build(elements)