【发布时间】:2020-06-17 18:02:33
【问题描述】:
我正在使用 Python 2.7 和 reportlab 来生成我的 PDF 文件。我想更改项目符号样式,例如我想使用破折号- 或检查✓ 或交叉x,而不是默认编号(1 2 3 4 5 ...)
这是我的代码:
styles = getSampleStyleSheet()
style = styles["Normal"]
t = ListFlowable(
[
Paragraph("Item no.1", style),
ListItem(Paragraph("Item no. 2", style),bulletColor="green",value=7),
Paragraph("Item no.4", style),
],
bulletType='1'
)
data = [[t, t, t, t]]
table = Table(data, colWidths=(4.83*cm))
table.setStyle(TableStyle([
('BOX', (0,0), (-1,-1), 0.7, colors.black)
]))
table.wrapOn(pdf, width, height)
table.drawOn(pdf, *coord(1.1, 21, cm))
我只是创建我的 FlowableList 并将其包装到一个表中。但实际上子弹类型是bulletType='1' 然后我有我的数字列表。我试图用bulletType='-' 替换它,但这不起作用。
您知道如何用另一个符号替换所有数字吗?
【问题讨论】: