[reportlab-users] Python ReportLab use of splitfirst/splitlast

Jessup, David DJESSUP at usnews.com
Wed Sep 17 16:36:23 EDT 2008


I'm trying to use Python with ReportLab 2.2 to create a PDF report.
According to the user guide at
http://www.reportlab.com/docs/userguide.pdf,


> Special TableStyle Indeces [sic]

>

> In any style command the first row index may be set to one of the

> special strings 'splitlast' or 'splitfirst' to indicate that the

> style should be used only for the last row of a split table, or the

> first row of a continuation. This allows splitting tables with nicer

> effects around the split.


I've tried to use splitfirst to create some special formatting for the
first row on a page:

main_table.setStyle(TableStyle([
('TEXTCOLOR', (0, 'splitfirst'), (1, 0), colors.black),
]))

and it breaks with the message:


> Traceback (most recent call last):

> File "./photo_payments_report.py", line 307, in <module>

> pdfize_data(data=payment_data, output_filename=output_filename)

> File "./photo_payments_report.py", line 128, in pdfize_data

> ('TEXTCOLOR', (0, 'splitfirst'), (1, 0), colors.black),

> File

"/usr/local/lib/python2.5/site-packages/reportlab/platypus/tables.py",
line 931, in setStyle

> self._addCommand(cmd)

> File

"/usr/local/lib/python2.5/site-packages/reportlab/platypus/tables.py",
line 992, in _addCommand

> for i in xrange(sr, er+1):

> TypeError: an integer is required


Is this functionality simply broken or am I doing something wrong? If
the latter, what am I doing wrong?




More information about the reportlab-users mailing list