[reportlab-users] Paragraph on a rounded box

Robin Becker robin at reportlab.com
Mon Feb 19 13:07:47 EST 2007


Andrea De Angeli wrote:

> Hello everybody.

>

> I am new to the list, and starting to apply reportlab library right now.

>

> I was not able to find a way to box my paragraph into a "rounded corner

> box".

> I know that I can draw a box around my pars by enclosing them in a

> table, but - again - only sharp corners.

>

> Any suggestions?

>

> Thanks to all

>

> A.

>

>.......


The very latest svn code now takes account of the following ParagraphStyle values


backColor
borderWidth
borderColor
borderWidth
borderpadding
borderRadius

I tried these combos inside test_platypus_breaking.py


bt1 = ParagraphStyle('bodyText1',bt)
bt1.borderWidth = 0.5
bt1.borderColor = colors.toColor('red')
bt1.backColor = colors.pink
bt1.borderRadius = 2
bt1.borderPadding = 3
a(Paragraph("""text one<br/>text two<br/>""",bt1))
a(Paragraph("Border no &lt;nr/&gt; at the end of the paragraph!",h3))
bt1 = ParagraphStyle('bodyText1',bt)
bt1.borderWidth = 0.5
bt1.borderColor = colors.toColor('red')
bt1.backColor = colors.pink
bt1.borderRadius = 2
bt1.borderPadding = 3
a(Paragraph("""text one<br/>text two""",bt1))
a(Paragraph("Different border style!",h3))
bt2 = ParagraphStyle('bodyText1',bt1)
bt2.borderWidth = 1.5
bt2.borderColor = colors.toColor('blue')
bt2.backColor = colors.gray
bt2.borderRadius = 3
bt2.borderPadding = 3
a(Paragraph("""text one<br/>text two<br/>""",bt2))


hope this works for you.
--
Robin Becker


More information about the reportlab-users mailing list