[reportlab-users] landscape vs. portrait format handling
Robert Krieg
reportlab-users@reportlab.com
Tue, 17 Dec 2002 12:22:55 -0800
Hi, I am creating an app which generates a platypus SimpleDocTemplate
table formatted .pdf document from a user supplied SQL database and
query. I am unable to know the correct page sizes (i.e. -
portrait/landscape) beforehand, as a result of the user supplying the
query. If there are too many elements in the query and the page sizes
are set to portrait, I get the error message.
" LayoutError: Flowable <Table at 9421224 229 rows x 10 cols>
with cell(0,0) containing 'LASTNAME' too large on page 2 "
At this point in the program, I catch the error and assign the page
sizes to that of Landscape, and try to "re-build" the template. I get
the following error:=20
Traceback (most recent call last):
File "C:\Python22\rLab\reportTemplate.py", line 189, in ?
report.run()
File "C:\Python22\rLab\reportTemplate.py", line 184, in run
self.goLandscape( result )
File "C:\Python22\rLab\reportTemplate.py", line 126, in
goLandscape
docTemplate.build( ( myStory ), onFirstPage=3Dself.myFirstPage,
onLaterPages=3Dself.myLaterPages )
File
"c:\Python22\ReportLab_1_16\reportlab\platypus\doctemplate.py", line
750, in build
BaseDocTemplate.build(self,flowables)
TypeError: unbound method build() must be called with
BaseDocTemplate instance as first=20
argument (got SimpleDocTemplate instance instead)
It seems as though the package was not set up to work in this fashion.
Is there an easier way to accomplish this automatic switch to landscape
when "Layout Error" exception is raised. Thanks, Rob