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

Robin Becker robin at reportlab.com
Sat May 14 03:56:05 EDT 2022


On 13/05/2022 13:12, Lennart Regebro wrote:
> Hi, sorry for the delay in this, I was on vacation.
> 
> Splitting spanned cells turns out to be not easy at all. Well, the
> splitting was no problem, it's dealing with the styles.
> 
> I believe I have found an edge case in Reportlab which I'm not sure if it's
> intended or not, and fixing it will require quite a major refactoring, so I
> would like your opinion on this. Basically, you can color a spanned cell
> only partially in current Reportlab, but supporting splitting such a cell
> leads to some weirdness.
> 
for what it's worth I don't think we need to 'fix' the styling edge case as it stands; if people really want to colour 
part of a span range then let them, but we can caution that if the cell needs splitting that won't always work 
correctly. The cell split is already a rare case.

> If you set the background color only on the starting cell for a spanned
> cell, then that whole cell will get that background color. But if you set a
> background color on only some out of the rows, only that part of the cell
> will get colored. If you then split that cell, then what parts of that
> split cell are colored can change,
> 
> Fixing this would require calculating the colors or all cells before a
> split, and then, when the table is drawn, not doing any such
> "recalculation". But the first question is: Is this really supported? Is
> that how it is supposed to work? That you can set partial background colors
> on spanned cells?
> 
> Attaching PDF that demonstrates this. I accidentally overwrote the code
> used to generate it, though. *facepalm*
> 
> //Lennart
..........

-- 
Robin Becker


More information about the reportlab-users mailing list