Fix for bug 609 (corner case of long table splitting throwed exception).
authorjonas
Mon, 05 Jan 2009 13:02:48 +0000
changeset 3038 04d53e2083bd
parent 3037 e014e27ec331
child 3039 42ecfd4a9344
Fix for bug 609 (corner case of long table splitting throwed exception).
src/reportlab/platypus/tables.py
--- a/src/reportlab/platypus/tables.py	Mon Jan 05 12:12:53 2009 +0000
+++ b/src/reportlab/platypus/tables.py	Mon Jan 05 13:02:48 2009 +0000
@@ -478,7 +478,6 @@
         return max([stringWidth(x,fontName,fontSize) for x in v])
 
     def _calc_height(self, availHeight, availWidth, H=None, W=None):
-
         H = self._argH
         if not W: W = _calc_pc(self._argW,availWidth)   #widths array
 
@@ -505,11 +504,6 @@
             FUZZ = rl_config._FUZZ
             while None in H:
                 i = H.index(None)
-                if longTable:
-                    hmax = i
-                    height = reduce(operator.add, H[:i], 0)
-                    # we can stop if we have filled up all available room
-                    if height > availHeight: break
                 V = self._cellvalues[i] # values for row i
                 S = self._cellStyles[i] # styles for row i
                 h = 0
@@ -547,6 +541,12 @@
                                 t = 0
                     if t>h: h = t   #record a new maximum
                 H[i] = h
+                # we can stop if we have filled up all available room
+                if longTable:
+                    hmax = i
+                    height = reduce(operator.add, H[:i], 0)
+                    if height > availHeight:
+                        break
             if None not in H: hmax = lim
 
             if spanCons: