[reportlab-users] keepWithNext problem
Robin Becker
robin at reportlab.com
Fri Nov 2 13:20:38 EDT 2007
Wietse Jacobs wrote:
> Hello,
>
> First of all, thanks for a great toolkit! I've only recently started
> using ReportLab so I'm still trying to figure things out.
>
> I've isolated a problem that I have. When I execute the following
> script:
I always hated keepWith next; this is a bug as presumably we shouldn't. Are you
really trying to keep a paragraph and a Drawing together? If so I think you need
to use some other kind of container as Drawings are normally particularly nasty
about what things can be set on them. Now fixed in SVN (or perhaps a different
bug is introduced)
> -----------------------------------------------------------
> from reportlab.platypus import *
> from reportlab.lib.styles import ParagraphStyle
> from reportlab.graphics.shapes import Drawing, Rect
>
>
> normal = ParagraphStyle(name='Normal',
> fontName='Helvetica',
> fontSize=8.5,
> leading=11)
>
> header = ParagraphStyle(name='Heading1',
> parent=normal,
> fontSize=14,
> leading=19,
> spaceAfter=6,
> keepWithNext=1)
>
> d = Drawing(400, 200)
> d.add(Rect(50, 50, 300, 100))
>
> story = [Paragraph("The section header", header), d]
>
> doc = SimpleDocTemplate('test.pdf')
> doc.build(story)
.......
--
Robin Becker
More information about the reportlab-users
mailing list