[reportlab-users] starting ol list item numbering from other value than '1'

Stephan Diehl stephan.diehl at gmx.net
Fri Sep 21 06:14:54 EDT 2007


Hi,

while using reportlab, I come across the usecase that I wanted to start
numbering of a ordered list (using the platypus.para Paragraph) from
another number than one. The syntax would be like the html equivalent,
such that
<ol>
<li value="3">an item</li>
<li>another item</li>
</ol>

gives an orderd list that starts at '3'

Below is a diff.

I'd be happy to make this into the main trunk as I woulnd't have to
patch all my reportlab installation myself :-)

Cheers

Stephan

Index: para.py
===================================================================
--- para.py (revision 3143)
+++ para.py (working copy)
@@ -1800,6 +1800,8 @@
self.count = 0

def makeBullet(self, atts, bl=None):
+ if self.tagname == 'ol' and 'value' in atts:
+ self.count = int(atts['value']) - 1
count = self.count = self.count+1
typ = self.typ
tagname = self.tagname


More information about the reportlab-users mailing list