【发布时间】:2022-04-04 04:46:55
【问题描述】:
我知道 ReportLab 可以使用“linejoin”和“linecap”设置使线条四舍五入。
对于表格,LINEBEFORE 或 LINEAFTER 命令将在表格上放置一条分隔两列的水平线。
有没有办法让这条线没有圆边?它默认为圆角。
此代码将创建一个示例表。如何使那条红色垂直线成为没有圆边的矩形?或者解决方案只是在列之间添加一个细列并用红色填充它。
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter, inch
from reportlab.platypus import Image, Paragraph, SimpleDocTemplate, Table
from reportlab.lib.styles import getSampleStyleSheet
doc = SimpleDocTemplate("delete_me.pdf", pagesize=letter)
# container for the 'Flowable' objects
elements = []
styleSheet = getSampleStyleSheet()
P0 = Paragraph('''
<b>A pa<font color=red>r</font>a<i>graph</i></b>
<super><font color=yellow>1</font></super>''',
styleSheet["BodyText"])
P = Paragraph('''
<para align=center spaceb=3>The <b>ReportLab Left
<font color=red>Logo</font></b>
Image</para>''',
styleSheet["BodyText"])
data= [['A', 'B', 'C', P, 'D'],
['00', '01', '02', P, '04'],
['10', '11', '12', P, '14'],
['20', '21', '22', '23', '24'],
['30', '31', '32', '33', '34']]
t=Table(data,style=[('LINEBEFORE',(2,1),(2,-2),6,colors.pink)]
)
t._argW[3]=1.5*inch
elements.append(t)
# write the document to disk
doc.build(elements)
【问题讨论】:
标签: reportlab