--- a/src/reportlab/__init__.py Tue May 12 17:28:27 2015 +0100
+++ b/src/reportlab/__init__.py Wed May 13 14:09:03 2015 +0100
@@ -1,9 +1,8 @@
-#Copyright ReportLab Europe Ltd. 2000-2012
+#Copyright ReportLab Europe Ltd. 2000-2015
#see license.txt for license details
-#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py
-__version__=''' $Id$ '''
__doc__="""The Reportlab PDF generation library."""
-Version = "3.1.58"
+Version = "3.1.59"
+__version__=Version
import sys, os, imp
--- a/src/reportlab/platypus/tables.py Tue May 12 17:28:27 2015 +0100
+++ b/src/reportlab/platypus/tables.py Wed May 13 14:09:03 2015 +0100
@@ -279,6 +279,8 @@
self._linecmds = []
self._spanCmds = []
self._nosplitCmds = []
+ # NB repeatRows can be a list or tuple eg (1,) reapesat only the second row of a table
+ # or an integer eg 2 to repeat both rows 0 & 1
self.repeatRows = repeatRows
self.repeatCols = repeatCols
self.splitByRow = splitByRow
@@ -1234,7 +1236,8 @@
def _splitRows(self,availHeight):
n=self._getFirstPossibleSplitRowPosition(availHeight)
- if n<=self.repeatRows: return []
+ repeatRows = self.repeatRows
+ if n<= (repeatRows if isinstance(repeatRows,int) else (max(repeatRows)+1)): return []
lim = len(self._rowHeights)
if n==lim: return [self]
@@ -1248,7 +1251,6 @@
elif n<lo:
return []
- repeatRows = self.repeatRows
repeatCols = self.repeatCols
splitByRow = self.splitByRow
data = self._cellvalues
@@ -1316,19 +1318,30 @@
if ident: ident = IdentStr(ident)
if repeatRows:
- #R1 = slelf.__class__(data[:repeatRows]+data[n:],self._argW,
- R1 = self.__class__(data[:repeatRows]+data[n:],colWidths=self._colWidths,
- rowHeights=self._argH[:repeatRows]+self._argH[n:],
- repeatRows=repeatRows, repeatCols=repeatCols,
+ if isinstance(repeatRows,int):
+ iRows = data[:repeatRows]
+ nRepeatRows = repeatRows
+ iRowH = self._argH[:repeatRows]
+ iCS = self._cellStyles[:repeatRows]
+ else:
+ #we have a list of repeated rows eg (1,3)
+ repeatRows = list(sorted(repeatRows))
+ iRows = [data[i] for i in repeatRows]
+ nRepeatRows = len(repeatRows)
+ iRowH = [self._argH[i] for i in repeatRows]
+ iCS = [self._cellStyles[i] for i in repeatRows]
+ R1 = self.__class__(iRows+data[n:],colWidths=self._colWidths,
+ rowHeights=iRowH+self._argH[n:],
+ repeatRows=nRepeatRows, repeatCols=repeatCols,
splitByRow=splitByRow, normalizedData=1,
- cellStyles=self._cellStyles[:repeatRows]+self._cellStyles[n:],
+ cellStyles=iCS+self._cellStyles[n:],
ident=ident,
spaceAfter=getattr(self,'spaceAfter',None),
)
- R1._cr_1_1(n,repeatRows,A)
- R1._cr_1_1(n,repeatRows,self._bkgrndcmds)
- R1._cr_1_1(n,repeatRows,self._spanCmds)
- R1._cr_1_1(n,repeatRows,self._nosplitCmds)
+ R1._cr_1_1(n,nRepeatRows,A)
+ R1._cr_1_1(n,nRepeatRows,self._bkgrndcmds)
+ R1._cr_1_1(n,nRepeatRows,self._spanCmds)
+ R1._cr_1_1(n,nRepeatRows,self._nosplitCmds)
else:
#R1 = slelf.__class__(data[n:], self._argW, self._argH[n:],
R1 = self.__class__(data[n:], colWidths=self._colWidths, rowHeights=self._argH[n:],