use*_*478 6 python pdf reportlab
如何在ReportLab中创建项目符号列表?文档令人沮丧地含糊不清.我在尝试:
text = ur '''
<para bulletText="•">
item 1
</para>
<para bulletText="•">
item 2
</para>
'''
Story.append(Paragraph(text,TEXT_STYLE))
Run Code Online (Sandbox Code Playgroud)
但我不断收到错误list index out of range
.看来我不能<para></para>
在一次通话中加一个以上Paragraph()
?我也试过设置,TEXT_STYLE.bulletText="•"
但这也不起作用......
bulletText参数实际上是Paragraph
对象的构造函数,而不是<para>
标记:-)试试这个:
story.append(Paragraph(text, TEXT_STYLE, bulletText='-'))
Run Code Online (Sandbox Code Playgroud)
但是,请查看ReportLab文档的第68页(现在,2012年第74页)中的示例.ReportLab中的约定似乎是使用<bullet>
标记,文档会警告您每个Paragraph
实例只能有一个.我们在ReportLab中渲染我们的项目符号如下:
story.append(Paragraph('<bullet>The rain in spain</bullet>', TEXT_STYLE))
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7038 次 |
最近记录: |