Python ReportLab ListFlowable使用自定义项目符号

Python ReportLab ListFlowable使用自定义项目符号,python,reportlab,Python,Reportlab,我正在使用Python2.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

我正在使用Python2.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是
bulletType='1'
,然后我有了我的数字列表。我试图用
bulletType='-'
替换它,但这不起作用


你知道如何用另一个符号替换所有数字吗?

我解决了我的问题。我在reportlab的bitbucket上找到了

以下是默认形状的列表

_bulletNames = dict(
                bulletchar=u'\u2022',  # usually a small circle
                circle=u'\u25cf',  # circle as high as the font
                square=u'\u25a0',
                disc=u'\u25cf',
                diamond=u'\u25c6',
                diamondwx=u'\u2756',
                rarrowhead=u'\u27a4',
                sparkle=u'\u2747',
                squarelrs=u'\u274f',
                blackstar=u'\u2605',
                )
我只需要添加start参数并设置我想要的

t = ListFlowable(
    [
        Paragraph("Item no.1", style),
        ListItem(Paragraph("Item no. 2", style), bulletColor="green", value=7),
        Paragraph("Item no.4", style),
    ],
    bulletType='1',
    start='-'  # You can use default shape or custom char like me here
)