[reportlab-users] KeepTogether not working with Spacers any more

Robin Becker robin at reportlab.com
Thu Jul 20 03:36:12 EDT 2006


Christoph Zwerschke wrote:
> I used to initialize a vertical spacer like
> 
> s = Spacer(0, 1*inch)
> 
> This worked nicely with ReportLab 1.20, but in ReportLab 1.21 I 
> experienced a problem if such spacers appear in a KeepTogether list.
> 
> I found the reason to be the following line that has been added to the 
> _listWrapOn() function calculating the height of the KeepTogether list 
> by summing up the heights of the individual flowables:
> 
> if w<=_FUZZ or h<=_FUZZ: continue
> 
> Here, _FUZZ is a very small value close to 0 (1e-6). This means that 
> spacers like the above with a horizontal dimension of 0 are ignored in 
> the calculation. I think this should be corrected.
> 
> As a work-around, I'm now initializing the spacers with a non-zero width 
> (and noticed that the user's guide does it similarly):
> 
> s = Spacer(1, 1*inch)
> 
....... for now this is the correct solution as we don't actually use 
the width for anything. Probably should fix the code so it attempst to 
special case the layout.
-- 
Robin Becker


More information about the reportlab-users mailing list