我使用reportlab 2.6的ListFlowable來製作帶有彩色圓圈項目符號的項目符號列表。但是,我希望子彈出現在文本旁邊,而不是與前面的非縮進文本對齊。我試圖打開ListFlowable源,但我找不到那裏。下面是我有:如何使項目符號直接出現在reportlab軟件包for python中縮進列表的文本旁邊?
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']))
my_list = ListFlowable(
[
ListItem(Paragraph("Line 1",styles['Normal'])
,bulletColor = CMYKColor(0.81, 0.45, 0.53, 0.23)
,value = 'circle'
),
ListItem(Paragraph("Line 2",styles['Normal'])
,bulletColor = CMYKColor(0.81, 0.45, 0.53, 0.23)
,value = 'circle'
)
],
bulletType='bullet',
start='circle'
)
Story.append(my_list)
doc.build(Story)
該代碼產生這樣的:
但我希望它看起來像:
我手動編輯的第二圖像來獲得預期的效果。
我曾想過在列表中想做一個列表,以得到一個縮進的子彈,但後來我不知道如何縮小文本更接近子彈。
這使子彈,我想它,但文字也移動之間的垂直間隙。理想情況下,子彈將與「1號線」中的「L」相鄰。 – 2013-02-21 08:52:22
完成編輯。如果我理解你的話,這應該是解決方案。 – floqqi 2013-02-21 09:15:56
太棒了!我實際上是在提問後不久就以另一種方式解決了這個問題(我會稍微公佈這個答案),但我喜歡這個問題 – 2013-02-21 21:04:50