在测试此How can I make the bullet appear directly next to the text of an indented list in the reportlab package for python?问题中提到的示例时,会打印unicode字符而不是项目符号。
这是我的代码..
# -*- coding: utf-8 -*-
from reportlab.platypus import Paragraph, ListFlowable, ListItem, SimpleDocTemplate, Frame
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.colors import CMYKColor
doc = SimpleDocTemplate("SOtest.pdf")
styles = getSampleStyleSheet()
Story = []
Story.append(Paragraph("Header Text, I dont want the bullets directly below the H"
,styles['Normal']))
style = styles['Normal']
t = ListFlowable(
[
# Paragraph("Item no.1", style),
ListItem(Paragraph("Item no. 2", style),bulletColor="green",value='circle'),
ListItem(Paragraph('sublist item 2', style),bulletColor='red',value='circle'),
],
bulletType="bullet",
start='circle',
leftIndent=50,
)
Story.append(t)
doc.build(Story)
在结果pdf上,我得到了
Header Text, I dont want the bullets directly below the H
\u25cf Item no. 2
\u25cf sublist item 2