Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:text': 0.05; 'msg': 0.09; '(0,': 0.16; '(1,': 0.16; '(2,': 0.16; '0),': 0.16; '1),': 0.16; '2)),': 0.16; '2),': 0.16; '[none]': 0.16; 'adjusting': 0.16; 'received:172.18.0': 0.16; 'subject:Formatting': 0.16; 'xxx,': 0.16; 'prevent': 0.16; 'seems': 0.21; 'example.': 0.24; 'oriented': 0.24; 'define': 0.26; 'gets': 0.27; 'tried': 0.27; 'rest': 0.29; 'compared': 0.30; 'label': 0.30; "skip:' 10": 0.31; 'boundary': 0.31; 'large.': 0.31; 'vertical': 0.31; 'thanks!': 0.32; 'text': 0.33; 'minimal': 0.33; 'table': 0.34; 'subject:with': 0.35; 'but': 0.35; 'there': 0.35; 'data,': 0.36; 'height': 0.36; 'in.': 0.36; "didn't": 0.36; 'charset:us-ascii': 0.36; 'too': 0.37; 'list': 0.37; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'little': 0.38; 'generating': 0.39; 'to:addr:python.org': 0.39; 'received:unknown': 0.61; 'affect': 0.61; 'more': 0.64; 'here': 0.66; 'overall': 0.69; 'upper': 0.74; 'hoping': 0.75; 'this...': 0.84 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=/24PZDiXryEUsaYH72AX4ulVzqSXihAXfE7Ql5lDP0I= c=1 sm=1 a=9LtAOMftIYoA:10 a=7PYXob_7ZXMA:10 a=AgG5ixNBvo4A:10 a=BLceEmwcHowA:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=oNw28mxuUhXRB3mVwYQ4Ag==:17 a=P-siwpo2cOdV5cPDKF4A:9 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 From: "Joseph L. Casale" To: "'python-list@python.org'" Subject: Formatting text in a table with reportlab Thread-Topic: Formatting text in a table with reportlab Thread-Index: Ac73QbJdds4uQB84S3WLW1YRt0B/eQ== Date: Thu, 12 Dec 2013 13:56:24 +0000 Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.18.0.201] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386856669 news.xs4all.nl 2937 [2001:888:2000:d::a6]:39463 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61711 I sent off a msg to the reportlab list but didn't find an answer, hoping so= meone here might have come across this... I am generating a table to hold text oriented by the specification of the l= abel it gets printed on. I need to compress the vertical size of the table a lit= tle more but the larger text in (1, 0) and (1, 1) as compared to the rest cause= s it to migrate downwards away from the upper boundary of the cell that it's in. Is there a better way to accomplish this or some way I can prevent the behavior? I have tried adjusting with the rowHeight in Table() but for the larger text in (1, 0) and (1, 1) to not migrate out of the cell, the overal= l cell height has to be too large. The ('VALIGN', (1, 0), (1, 1), 'TOP') seem= s to only have a minimal affect if the rowHeight is still larger than what I wan= t versus [None] for example. # Define table data. data =3D [ ['foo', xxx, yyy, zzz, www], ['bar', ttt, uuu], ['\n'.join((iii, jjj, kkk))], ] # Define table dimensions. table =3D Table( data, [.625 * inch] + [None] * 4, [None] * 3 ) # Define table styles. table_style =3D [ ('VALIGN', (0, 0), (-1, -1), 'BOTTOM'), ('VALIGN', (1, 0), (1, 1), 'TOP'), ('ALIGN', (0, 0), (0, 2), 'LEFT'), ('ALIGN', (1, 0), (1, 1), 'LEFT'), ('ALIGN', (2, 0), (2, 0), 'CENTER'), ('SPAN', (2, 1), (4, 1)), ('SPAN', (0, 2), (4, 2)), ('FONTSIZE', (0, 0), (0, 2), 10), ('TEXTFONT', (0, 0), (0, 2), 'Times'), ('FONTSIZE', (1, 0), (1, 1), 18), ('TEXTFONT', (1, 0), (1, 1), 'Times-Bold') ] Thanks! jlc