[reportlab-users] Problem with a class derived from Table
shawn a
boris317 at gmail.com
Tue Jan 22 10:39:19 EST 2008
Hello,
I have a custom table class whose base is Table. When i pass in data
rows and the table can render itself on ONE page there is no issue.
But when i pass in a larger data rows list that need to split onto
other pages i get an exception.
For the purpose of this email I've stripped the custom table class down to this:
from reportlab.platypus import Table
class MyTable(Table):
def __init__(self,data,**kw):
Table.__init__(self,data,**kw)
then in my code
t = MyTable(data,style=s[0])
I am getting the following exception when the table needs to splitByRows:
Traceback (most recent call last):
File "./CreatePDF.py", line 155, in ?
sys.exit(main())
File "./CreatePDF.py", line 144, in main
pdfGen.DrawPDF(elements)
File "/home/boris317/code/python/csvproc/PDF_AutoProd.py", line 66,
in DrawPDF self.__doc.build(elements)
File "/usr/lib/python2.4/site-packages/reportlab/platypus/doctemplate.py",
line 644, in build
self.handle_flowable(flowables)
File "/usr/lib/python2.4/site-packages/reportlab/platypus/doctemplate.py",
line 569, in handle_flowable
S = self.frame.split(f,self.canv)
File "/usr/lib/python2.4/site-packages/reportlab/platypus/frames.py",
line 158, in split
r = flowable.split(self._aW, y-p-s)
File "/usr/lib/python2.4/site-packages/reportlab/platypus/tables.py",
line 942, in split
return self._splitRows(availHeight)
File "/usr/lib/python2.4/site-packages/reportlab/platypus/tables.py",
line 860, in _splitRows
splitByRow=splitByRow)
TypeError: __init__() takes exactly 2 non-keyword arguments (4 given)
To recap my custom table class throws the above exception if the list
data is to large and the table needs to split across pages. It works
fine if the table can be rendered onto one page
OR i use the Table class exclusively:(like so)
t = Table(data,style=s[0])
thanks,
-Shawn
More information about the reportlab-users
mailing list