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

Lennart Regebro lregebro at shoobx.com
Mon May 23 06:17:43 EDT 2022


OK, that was a lot of work, but now I can't find more edge cases...

v6 of the patch attached

On Sat, May 14, 2022 at 9:56 AM Robin Becker <robin at reportlab.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20220523/0798ae07/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: splitInRow-v6.diff
Type: text/x-patch
Size: 52698 bytes
Desc: not available
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20220523/0798ae07/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_table_inrowsplit.pdf
Type: application/pdf
Size: 11829 bytes
Desc: not available
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20220523/0798ae07/attachment-0001.pdf>


More information about the reportlab-users mailing list