reportlab/platypus/tables.py
changeset 1207 49a514d10cb0
parent 1169 eac596d94a3b
child 1218 07492dc0be86
equal deleted inserted replaced
1206:ce293b99abaf 1207:49a514d10cb0
     1 #copyright ReportLab Inc. 2000
     1 #copyright ReportLab Inc. 2000
     2 #see license.txt for license details
     2 #see license.txt for license details
     3 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/platypus/tables.py?cvsroot=reportlab
     3 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/platypus/tables.py?cvsroot=reportlab
     4 #$Header: /tmp/reportlab/reportlab/platypus/tables.py,v 1.42 2001/08/29 15:01:13 rgbecker Exp $
     4 #$Header: /tmp/reportlab/reportlab/platypus/tables.py,v 1.43 2001/09/13 19:06:43 aaron_watters Exp $
     5 __version__=''' $Id: tables.py,v 1.42 2001/08/29 15:01:13 rgbecker Exp $ '''
     5 __version__=''' $Id: tables.py,v 1.43 2001/09/13 19:06:43 aaron_watters Exp $ '''
     6 __doc__="""
     6 __doc__="""
     7 Tables are created by passing the constructor a tuple of column widths, a tuple of row heights and the data in
     7 Tables are created by passing the constructor a tuple of column widths, a tuple of row heights and the data in
     8 row order. Drawing of the table can be controlled by using a TableStyle instance. This allows control of the
     8 row order. Drawing of the table can be controlled by using a TableStyle instance. This allows control of the
     9 color and weight of the lines (if any), and the font, alignment and padding of the text.
     9 color and weight of the lines (if any), and the font, alignment and padding of the text.
    10 
    10 
    21 ### HACK HACK HACK
    21 ### HACK HACK HACK
    22 # NUDGE SHOULD BE DISABLED FOR TABLES INSIDE TABLES
    22 # NUDGE SHOULD BE DISABLED FOR TABLES INSIDE TABLES
    23 DO_NUDGE = 1
    23 DO_NUDGE = 1
    24 
    24 
    25 from reportlab.platypus import *
    25 from reportlab.platypus import *
       
    26 from reportlab import rl_config
    26 from reportlab.lib.styles import PropertySet, getSampleStyleSheet
    27 from reportlab.lib.styles import PropertySet, getSampleStyleSheet
    27 from reportlab.lib import colors
    28 from reportlab.lib import colors
    28 from reportlab.lib.utils import fp_str
    29 from reportlab.lib.utils import fp_str
    29 from reportlab.pdfbase import pdfmetrics
    30 from reportlab.pdfbase import pdfmetrics
    30 import operator, string
    31 import operator, string
   226 						if w is None:
   227 						if w is None:
   227 							raise ValueError, "Flowable %s in cell(%d,%d) can't have auto width in\n%s" % (v[0].identity(30),i,j,self.identity(30))
   228 							raise ValueError, "Flowable %s in cell(%d,%d) can't have auto width in\n%s" % (v[0].identity(30),i,j,self.identity(30))
   228 						dW,t = _listCellGeom(v,w,s)
   229 						dW,t = _listCellGeom(v,w,s)
   229 						#print "leftpadding, rightpadding", s.leftPadding, s.rightPadding
   230 						#print "leftpadding, rightpadding", s.leftPadding, s.rightPadding
   230 						dW = dW + s.leftPadding + s.rightPadding
   231 						dW = dW + s.leftPadding + s.rightPadding
   231 						if dW>w:
   232 						if not rl_config.allowTableBoundsErrors and dW>w:
   232 							raise "LayoutError", "Flowable %s (%sx%s points) too wide for cell(%d,%d) (%sx* points) in\n%s" % (v[0].identity(30),fp_str(dW),fp_str(t),i,j, fp_str(w), self.identity(30))
   233 							raise "LayoutError", "Flowable %s (%sx%s points) too wide for cell(%d,%d) (%sx* points) in\n%s" % (v[0].identity(30),fp_str(dW),fp_str(t),i,j, fp_str(w), self.identity(30))
   233 					else:
   234 					else:
   234 						if t is not StringType:
   235 						if t is not StringType:
   235 							v = v is None and '' or str(v)
   236 							v = v is None and '' or str(v)
   236 						v = string.split(v, "\n")
   237 						v = string.split(v, "\n")