【问题标题】:Reportlab Unordered List not showing bulletsReportlab 无序列表不显示项目符号
【发布时间】:2015-07-10 09:07:16
【问题描述】:

每当用户使用 TinyMCE 输入无序列表时,它在源代码下会如下所示

<ul>
 <li>item 1</li>
 <li>item 2</li>
 <li>item 3</li></ul>

当它使用 reportlab 呈现为 PDF 时,它显示时没有项目符号 像这样在同一行:

项目 1 项目 2 项目 3

下面是reportlab代码:

<paraStyle name="long_td_contents_right_notes"
    alignment="right"
    fontName="ACaslon-SemiBold"
    fontSize="8"/>



<blockTable style="blocktablestyle1" colWidths="145,{{if wide}}328{{else}}250{{endif}}">
        {{ for note in notes }}
            <tr><td align="left"><para style="long_td_contents_left">{{ rml(note.title) }}</para></td><td align="left"><para style="long_td_contents_left_notes"> {{ rml(note.body) }}</para></td></tr>
        {{endfor}}

对此的任何帮助将不胜感激。

谢谢

【问题讨论】:

    标签: python tinymce pdf-generation reportlab rml


    【解决方案1】:

    这行得通。

    {{ for note in notes }}
            {{script}}
                    notesWithBullets =  rml( note.body.replace('<li>', '&bull; ').replace('</p>','<br>').replace('</ul>','<br>').replace('</li>', '<br>'))
            {{endscript}}
                 <tr><td align="left"><para style="long_td_contents_left">{{ rml(note.title) }}</para></td><td align="left"><para style="long_td_contents_left">{{ rml(notesWithBullets) }}</para></td></tr>
    {{endfor}}
    

    【讨论】:

      猜你喜欢
      • 2019-12-07
      • 2010-09-07
      • 1970-01-01
      • 1970-01-01
      • 2012-04-20
      • 2017-10-04
      • 1970-01-01
      • 1970-01-01
      • 2017-09-30
      相关资源
      最近更新 更多