[reportlab-users] Wrapping text -- changing space between wrapped lines?

3 views
Skip to first unread message

Funke, Matt

unread,
Aug 28, 2012, 10:35:06 AM8/28/12
to reportlab-users

I’ve got some text going into a grid with tightly-defined space in each column.  Of course, if it doesn’t fit in the defined column width, it wraps around, and that’s fine.  The problem seems to arise when the text is too long.  If I could reduce the amount of space in between each line during wraparound, it would still fit nicely.  Could someone point me to information about how to do that within a reportlab.playtpus.tables.Table?

 

Thanks for your time.  Let me know if there’s any way I can clarify what I’m after.

 

Matt Funke

Programmer/Analyst

Vishay Precision Group, Inc.

951 Wendell Blvd

Wendell, NC 27591 USA

Office: 919-374-5553

Mobile: 919-628-9261

Fax: 919-374-5248

 

Robin Becker

unread,
Aug 30, 2012, 8:58:09 AM8/30/12
to reportlab-users
On 28/08/2012 15:35, Funke, Matt wrote:
> I've got some text going into a grid with tightly-defined space in each column. Of course, if it doesn't fit in the defined column width, it wraps around, and that's fine. The problem seems to arise when the text is too long. If I could reduce the amount of space in between each line during wraparound, it would still fit nicely. Could someone point me to information about how to do that within a reportlab.playtpus.tables.Table?
>
> Thanks for your time. Let me know if there's any way I can clarify what I'm after.

You are presumably using a paragraph to wrap the text. The property that sets
the interline spacing is called leading; by default I think we use 1.2*fontSize
for leading, but you can alter it in the style that's used. If you are using the
same style elsewhere then you should create a copy using

cellStyle = ParagraphStyle(name='cellStyle',parent=originalStyle,leading=7.5)

so that the leading change isn't applied where you don't want it.

Also table cells have padding which you can set to zero to increase the total
area of the cell that gets used.
--
Robin Becker
_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users

Funke, Matt

unread,
Sep 13, 2012, 10:34:27 AM9/13/12
to reportlab-users
Thanks for this! It worked like a charm.

Matt Funke
Programmer/Analyst
Vishay Precision Group, Inc.
951 Wendell Blvd
Wendell, NC 27591 USA
Office: 919-374-5553
Mobile: 919-628-9261
Fax: 919-374-5248


Reply all
Reply to author
Forward
0 new messages