[reportlab-users] Long word in paragraph in table cell
Simon Metson
s.metson at bristol.ac.uk
Thu Aug 30 17:31:15 EDT 2007
Hello,
I'm writing a document using Reportlab, and so far so good. However,
I have a table, whose contents are paragraphs (though there's no need
for them to be). The contents of some of the table cells will be long
strings without spaces, strings longer than the width of the cell.
I'd like a way to automatically split the string, at the width of the
cell minus any padding. Is there a way to do this? I thought I might
be able to wrap the Paragraph, but I can't see how. I could set
keepInFrame = shrink, but there's a good chance the strings would
become unreadable.
A sample bit of code would be:
data = [
[Paragraph
("Averyveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryv
eryverylongstringindeed", style["TableHeader"]),
Paragraph("Thing", style["TableHeader"])]
]
t = Table(data,
colWidths=((A4[0])/8 ,A4[0]/8),
style=[('BACKGROUND',(0,0),(-1, 0),'#dddddd'),
('INNERGRID', (0,0), (-1,-1), 0.25, colors.grey),
('BOX', (0,0), (-1,-1), 0.5, colors.black),
('VALIGN', (0,0), (-1,-1),'MIDDLE')])
Thanks for any help or advice,
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070830/34239594/attachment.html>
More information about the reportlab-users
mailing list