[reportlab-users] Problems with filling cells with large paragraphs (LayoutError: Flowable)

Nathan nathan.stocks at gmail.com
Wed Feb 1 15:13:36 EST 2006


I'll second this request for help.  I've run into the same two issues.
 I've been trying to work around the "Paragraph too large" error by
catching the crash and then splitting all large-looking paragraphs
into smaller paragraphs and using more rows in the table and then
redoing the template and rebuilding, but that's a rather messy method
and almost doubles my code length, not to mention that I end up with
more rows than I should.

Seems like table cells just need to be able to split across multiple pages.

~ Nathan

On 2/1/06, Claudio Battaglino <c.battaglino at icube.it> wrote:
> Hi,
> I've some two problems with cells containing long paragraphs.
>
> First, running the following script I've a LayoutError because the cell
> contains a too large paragraph.
> How can I solve this problem?
>
> Second, if I have a string longer that the column size, with few blanks
> (long_string="thisisaverylongstring"), the content of the first column
> overflows into the second column.
> Is it possible to force the paragraph to wrap to new line?
>
> Thank you very much
>
> claudio :-)
>
>
>
>
> ***script:
>
> from reportlab.lib import colors
> from reportlab.lib.styles import getSampleStyleSheet
> styles = getSampleStyleSheet()
>
>
> def printPDF():
>      doc = SimpleDocTemplate("test.pdf")
>      Story = []
>      cwidths = [ 1 * cm, 3 * cm]
>      tableData = []
>      first_string = "ciao "
>      long_string =first_string * 100
>      second_string = "bye bye"
>      style = styles['Normal']
>      long_paragraph = Paragraph(long_string, style)
>      second_paragraph = Paragraph(second_string, style)
>
>
>      tableData.append([long_paragraph, second_paragraph])
>      table = LongTable(tableData, cwidths, \
>          style=[('GRID', (0,0),(-1,-1), 1, colors.black)])
>      Story.append(table)
>      doc.build(Story)
>
>
> if __name__=="__main__":
>      printPDF()
>
> ***error:
>
> claudio at millenium:~/Desktop$ python provarep.py
> Traceback (most recent call last):
>    File "provarep.py", line 29, in ?
>      printPDF()
>    File "provarep.py", line 25, in printPDF
>      doc.build(Story)
>    File
> "/usr/lib/python2.3/site-packages/reportlab/platypus/doctemplate.py",
> line 814, in build
>      BaseDocTemplate.build(self,flowables)
>    File
> "/usr/lib/python2.3/site-packages/reportlab/platypus/doctemplate.py",
> line 644, in build
>      self.handle_flowable(flowables)
>    File
> "/usr/lib/python2.3/site-packages/reportlab/platypus/doctemplate.py",
> line 586, in handle_flowable
>      raise LayoutError("Flowable %s too large on page %d" %
> (f.identity(30), self.page))
> reportlab.platypus.doctemplate.LayoutError: Flowable <LongTable at
> 1079084396 1 rows x 2 cols> with cell(0,0) containing
> '<Paragraph at 1079061452>ciao ciao ciao ciao ciao ciao ' too large on
> page 2
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>


More information about the reportlab-users mailing list