[reportlab-users] table

ÿffffcaÿffffbfÿffffb7ÿffffbc ÿffffcdÿfffff5 reportlab-users@reportlab.com
Sun, 28 Mar 2004 10:28:44 +0800 (CST)


--0-730779247-1080440924=:84681
Content-Type: multipart/alternative; boundary="0-999753453-1080440924=:84681"

--0-999753453-1080440924=:84681
Content-Type: text/plain; charset=gb2312
Content-Transfer-Encoding: 8bit

Hi: 
the following is making the table,I specify the colwidth ,the cell[2,3] is too long,how can I make it  automatically go to next line?not to modify the colwidth.
 
 
from reportlab.test import unittest
from reportlab.test.utils import makeSuiteForClasses
from reportlab.platypus import Spacer, SimpleDocTemplate, Table, TableStyle
from reportlab.lib.units import inch
from reportlab.lib import colors
def getTable():
    data= [['A', 'B', 'C', 'dsdf'],
    ['00', '01', '02', 'df' ],
    ['10', '11', '12', 'sfasds fdfg sdg sdgf' ]]
    t=Table(data,style=[
    ('BOX',(0,0),(-1,-1),1,colors.black),
    ])
    t._argW[3]=0.3*inch
    return t
def run():
    doc = SimpleDocTemplate('tables.pdf', pagesize=(8.5*inch, 11*inch), showBoundary=0)
    lst = []
    t = getTable()
    lst.append(t)
    doc.build(lst)
class TablesTestCase(unittest.TestCase):  
   def test0(self):
        run()
def makeSuite():
    return makeSuiteForClasses(TablesTestCase)
if __name__ == "__main__":
    unittest.TextTestRunner().run(makeSuite())
 
Thanks





---------------------------------
Do You Yahoo!?
ÍêÈ«Ãâ·ÑµÄÑÅ»¢µçÓÊ£¬ÂíÉÏ×¢²á»ñÔù¶îÍâ60Õ×ÍøÂç´æ´¢¿Õ¼ä
--0-999753453-1080440924=:84681
Content-Type: text/html; charset=gb2312
Content-Transfer-Encoding: 8bit

<DIV>
<DIV>Hi: </DIV>
<DIV>the following is&nbsp;making the table,I specify the colwidth&nbsp;,the cell[2,3] is too long,how can I make it&nbsp; automatically go to next line?not to modify the colwidth.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>from reportlab.test import unittest<BR>from reportlab.test.utils import makeSuiteForClasses<BR>from reportlab.platypus import Spacer, SimpleDocTemplate, Table, TableStyle<BR>from reportlab.lib.units import inch<BR>from reportlab.lib import colors<BR>def getTable():<BR>&nbsp;&nbsp;&nbsp; data= [['A', 'B', 'C', 'dsdf'],<BR>&nbsp;&nbsp;&nbsp; ['00', '01', '02', 'df' ],<BR>&nbsp;&nbsp;&nbsp; ['10', '11', '12', <STRONG>'sfasds fdfg sdg sdgf'</STRONG> ]]<BR>&nbsp;&nbsp;&nbsp; t=Table(data,style=[<BR>&nbsp;&nbsp;&nbsp; ('BOX',(0,0),(-1,-1),1,colors.black),<BR>&nbsp;&nbsp;&nbsp; ])<BR><STRONG>&nbsp;&nbsp;&nbsp; t._argW[3]=0.3*inch</STRONG><BR>&nbsp;&nbsp;&nbsp; return t<BR>def run():<BR>&nbsp;&nbsp;&nbsp; doc = SimpleDocTemplate('tables.pdf', pagesize=(8.5*inch, 11*inch), showBoundary=0)<BR>&nbsp;&nbsp;&nbsp; lst = []<BR>&nbsp;&nbsp;&nbsp; t = getTable()<BR>&nbsp;&nbsp;&nbsp; lst.append(t)<BR>&nbsp;&nbsp;&nbsp; doc.build(lst)<BR>class TablesTestCase(unittest.TestCase):&nbsp;&nbsp;</DIV>
<DIV>&nbsp;&nbsp; def test0(self):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; run()<BR>def makeSuite():<BR>&nbsp;&nbsp;&nbsp; return makeSuiteForClasses(TablesTestCase)<BR>if __name__ == "__main__":<BR>&nbsp;&nbsp;&nbsp; unittest.TextTestRunner().run(makeSuite())</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks<BR></DIV></DIV><p><br><hr size=1><b>Do You Yahoo!?</b><br>
<a href="http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.mail.yahoo.com" target=blank>ÍêÈ«Ãâ·ÑµÄÑÅ»¢µçÓÊ£¬ÂíÉÏ×¢²á»ñÔù¶îÍâ60Õ×ÍøÂç´æ´¢¿Õ¼ä</a>
--0-999753453-1080440924=:84681--
--0-730779247-1080440924=:84681
Content-Type: application/pdf; name="tables.pdf"
Content-Transfer-Encoding: base64
Content-Description: tables.pdf
Content-Disposition: attachment; filename="tables.pdf"

JVBERi0xLjMNCiWTjIueIFJlcG9ydExhYiBHZW5lcmF0ZWQgUERGIGRvY3Vt
ZW50IGh0dHA6Ly93d3cucmVwb3J0bGFiLmNvbQ0KJSAnQmFzaWNGb250cyc6
IGNsYXNzIFBERkRpY3Rpb25hcnkgDQoxIDAgb2JqDQolIFRoZSBzdGFuZGFy
ZCBmb250cyBkaWN0aW9uYXJ5DQo8PCAvRjEgMiAwIFINCiAvRjIgMyAwIFIg
Pj4NCmVuZG9iag0KJSAnRjEnOiBjbGFzcyBQREZUeXBlMUZvbnQgDQoyIDAg
b2JqDQolIEZvbnQgSGVsdmV0aWNhDQo8PCAvQmFzZUZvbnQgL0hlbHZldGlj
YQ0KIC9FbmNvZGluZyAvV2luQW5zaUVuY29kaW5nDQogL05hbWUgL0YxDQog
L1N1YnR5cGUgL1R5cGUxDQogL1R5cGUgL0ZvbnQgPj4NCmVuZG9iag0KJSAn
RjInOiBjbGFzcyBQREZUeXBlMUZvbnQgDQozIDAgb2JqDQolIEZvbnQgVGlt
ZXMtUm9tYW4NCjw8IC9CYXNlRm9udCAvVGltZXMtUm9tYW4NCiAvRW5jb2Rp
bmcgL1dpbkFuc2lFbmNvZGluZw0KIC9OYW1lIC9GMg0KIC9TdWJ0eXBlIC9U
eXBlMQ0KIC9UeXBlIC9Gb250ID4+DQplbmRvYmoNCiUgJ1BhZ2UxJzogY2xh
c3MgUERGUGFnZSANCjQgMCBvYmoNCiUgUGFnZSBkaWN0aW9uYXJ5DQo8PCAv
Q29udGVudHMgOCAwIFINCiAvTWVkaWFCb3ggWyAwDQogIDANCiAgNjEyDQog
IDc5MiBdDQogL1BhcmVudCA3IDAgUg0KIC9SZXNvdXJjZXMgPDwgL0ZvbnQg
MSAwIFINCiAgL1Byb2NTZXQgW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