[reportlab-users] Patch to support tables with oversize cells

Robin Becker robin at reportlab.com
Mon May 30 04:05:48 EDT 2022


On 29/05/2022 10:58, Robin Becker wrote:
> Hi Lennart,
> 
> I did the obvious monkey patch to the Table class and can now see that the splitInRow case table split method is 
> modifying something in the original table.
> 
> The two split offspring don't seem to show any differences between the standard and patched case.
> 
> .......
..........

Hi Lennart, I did some more investigation and find that the _linecmds of the table that is split are changed by the 
split method.

unpatched case

before split
('GRID', (0, 0), (-1, -1), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('GRID', (1, 1), (-2, -2), 1, Color(0,.501961,0,1), 1, None, 1, 1, 1)
('BOX', (0, 0), (1, -1), 2, Color(1,0,0,1), 1, None, 1, 1, 2)
('BOX', (0, 0), (-1, -1), 2, Color(0,0,0,1), 1, None, 1, 1, 2)
('LINEABOVE', (1, 2), (-2, 2), 1, Color(0,0,1,1), 1, None, 1, 1, 1)
('LINEBEFORE', (2, 1), (2, -2), 1, Color(1,.752941,.796078,1), 1, None, 1, 1, 1)
after  split
('GRID', (0, 0), (-1, -1), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('GRID', (1, 1), (-2, -2), 1, Color(0,.501961,0,1), 1, None, 1, 1, 1)
('BOX', (0, 0), (1, -1), 2, Color(1,0,0,1), 1, None, 1, 1, 2)
('BOX', (0, 0), (-1, -1), 2, Color(0,0,0,1), 1, None, 1, 1, 2)
('LINEABOVE', (1, 2), (-2, 2), 1, Color(0,0,1,1), 1, None, 1, 1, 1)
('LINEBEFORE', (2, 1), (2, -2), 1, Color(1,.752941,.796078,1), 1, None, 1, 1, 1)


patched case
before split
('GRID', (0, 0), (-1, -1), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('GRID', (1, 1), (-2, -2), 1, Color(0,.501961,0,1), 1, None, 1, 1, 1)
('BOX', (0, 0), (1, -1), 2, Color(1,0,0,1), 1, None, 1, 1, 2)
('BOX', (0, 0), (-1, -1), 2, Color(0,0,0,1), 1, None, 1, 1, 2)
('LINEABOVE', (1, 2), (-2, 2), 1, Color(0,0,1,1), 1, None, 1, 1, 1)
('LINEBEFORE', (2, 1), (2, -2), 1, Color(1,.752941,.796078,1), 1, None, 1, 1, 1)
after  split
('LINEABOVE', (0, 0), (4, 0), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('LINEBEFORE', (0, 0), (0, 3), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('LINEAFTER', (4, 0), (4, 3), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('LINEBELOW', (0, 3), (4, 3), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('LINEBELOW', (0, 0), (4, 0), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('LINEABOVE', (0, 1), (4, 1), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('INNERGRID', (0, 0), (4, 3), 0.5, Color(.501961,.501961,.501961,1), 1, None, 1, 1, 0.5)
('GRID', (1, 1), (3, 2), 1, Color(0,.501961,0,1), 1, None, 1, 1, 1)
('LINEABOVE', (0, 0), (1, 0), 2, Color(1,0,0,1), 1, None, 1, 1, 2)
('LINEBEFORE', (0, 0), (0, 3), 2, Color(1,0,0,1), 1, None, 1, 1, 2)
('LINEAFTER', (1, 0), (1, 3), 2, Color(1,0,0,1), 1, None, 1, 1, 2)
('LINEBELOW', (0, 3), (1, 3), 2, Color(1,0,0,1), 1, None, 1, 1, 2)
('LINEABOVE', (0, 0), (4, 0), 2, Color(0,0,0,1), 1, None, 1, 1, 2)
('LINEBEFORE', (0, 0), (0, 3), 2, Color(0,0,0,1), 1, None, 1, 1, 2)
('LINEAFTER', (4, 0), (4, 3), 2, Color(0,0,0,1), 1, None, 1, 1, 2)
('LINEBELOW', (0, 3), (4, 3), 2, Color(0,0,0,1), 1, None, 1, 1, 2)
('LINEABOVE', (1, 2), (3, 2), 1, Color(0,0,1,1), 1, None, 1, 1, 1)
('LINEBEFORE', (2, 1), (2, 2), 1, Color(1,.752941,.796078,1), 1, None, 1, 1, 1)


I assume somehow that one or more of the splitting table's lists has leaked into the split somewhere. I'll try and hack 
some code to see where that is.
-- 
Robin Becker


More information about the reportlab-users mailing list