【发布时间】:2016-03-11 17:25:46
【问题描述】:
我使用Reportlap,对于我的标题我使用SPAN,但我的输出是:
我的代码是:
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter, inch,A5
from reportlab.platypus import Image, Paragraph, SimpleDocTemplate, Table
from reportlab.lib.styles import getSampleStyleSheet
doc = SimpleDocTemplate("complex_cell_values.pdf", pagesize=A5)
elements = []
styleSheet = getSampleStyleSheet()
I = Image('replogo.gif')
I.drawHeight = 1.6*inch
I.drawWidth = 5*inch
data= [['','',I,'',''],
['Total Price', 'Price', 'QTY','Description', 'S.No'],
['00', 'rial 360,000', '02', '05', '04'],
['10', '11', '12', '06', '14'],
['20', '21', '22', '23', '24'],
['30', '31', '32', '33', '34']]
t=Table(data,style=[('BOX',(0,0),(-1,-1),2,colors.black),
('GRID',(0,1),(-1,-1),0.5,colors.black),
('SPAN',(0,0),(1,0)),
('SPAN',(3,0),(4,0)),
('ALIGN',(1,0),(4,-1),'CENTER')
])
t._argW[3]=1.5*inch
elements.append(t)
doc.build(elements)
有人知道我该如何解决这个问题吗?
【问题讨论】:
标签: python python-3.x reportlab