Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61711

Formatting text in a table with reportlab

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 <jcasale@activenetwerx.com>
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" <jcasale@activenetwerx.com>
To "'python-list@python.org'" <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3990.1386856669.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


I sent off a msg to the reportlab list but didn't find an answer, hoping someone
here might have come across this...

I am generating a table to hold text oriented by the specification of the label
it gets printed on. I need to compress the vertical size of the table a little
more but the larger text in (1, 0) and (1, 1) as compared to the rest causes 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 overall
cell height has to be too large. The ('VALIGN', (1, 0), (1, 1), 'TOP') seems to
only have a minimal affect if the rowHeight is still larger than what I want
versus [None] for example.

        # Define table data.
        data = [
            ['foo', xxx, yyy, zzz, www],
            ['bar', ttt, uuu],
            ['\n'.join((iii, jjj, kkk))],
        ]

        # Define table dimensions.
        table = Table(
            data,
            [.625 * inch] + [None] * 4,
            [None] * 3
        )

        # Define table styles.
        table_style = [
            ('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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Formatting text in a table with reportlab "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-12-12 13:56 +0000

csiph-web