[reportlab-users] how to change only one row height in a table

2,570 views
Skip to first unread message

Mike Driscoll

unread,
Sep 12, 2013, 5:35:53 PM9/12/13
to reportlab-users
Hi,

I need to change the row height of a single row in a table. So for example, say I have a Table object with 5 rows and I want to make the height of the 4th row smaller than all the others. How would I do that? I tried changing the padding values for that row to no effect. I also tried setting the leading value, but that didn't affect it either...not that I really thought that one would.

Any hints would be appreciated. Thanks!

-------------------
Mike Driscoll

Blog:   http://blog.pythonlibrary.org

Robin Becker

unread,
Sep 13, 2013, 5:33:53 AM9/13/13
to reportlab-users
You need to set up a rowHeights list in the Table() creation.

So if you have nrows=len(data) do

rowHeights = nrows*[None] or rowHeights = nrows*[myStandardRowHeight]

rowHeights[3] = 5

tbl = Table(data,....rowHeights=rowHeights)
--
Robin Becker
_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users

Mike Driscoll

unread,
Sep 13, 2013, 9:20:21 AM9/13/13
to reportl...@googlegroups.com, reportlab-users, ro...@reportlab.com
Hi Robin,


On Friday, September 13, 2013 4:33:53 AM UTC-5, Robin Becker wrote:
You need to set up a rowHeights list in the Table() creation.

So if you have nrows=len(data) do

rowHeights = nrows*[None] or rowHeights = nrows*[myStandardRowHeight]

rowHeights[3] = 5

tbl = Table(data,....rowHeights=rowHeights)

I thought about using rowHeights, but for some reason I was having trouble figuring out how to do it dynamically last night since I don't really know how many rows will be in the table ahead of time. Thanks for the tip. I don't think I've ever seen someone create a list like that before.

- Mike
Reply all
Reply to author
Forward
0 new messages