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

Robin Becker robin at reportlab.com
Fri Sep 21 06:45:01 EDT 2007


Stephan Diehl wrote:

> 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>

>

.........

>

> 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

.......
Thanks for the patch, but I'm a bit confused. Your example puts the value in the
li element, but the patch seems to assume it will be on the containing ol. If
you put a value in the <li> then it won't be needed on the ol etc etc. In fact
bot ideas are possible, but what do others think. I don't get to use para much
so I'm not really an expert. The other Paragraph class has more extensive
features for sequences eg resetting chaining etc etc.
--
Robin Becker


More information about the reportlab-users mailing list