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

Lennart Regebro lregebro at shoobx.com
Mon Mar 7 11:13:29 EST 2022


On Wed, Feb 23, 2022 at 11:51 AM Robin Becker <robin at reportlab.com> wrote:

> Bad
>   1) the split return wrongly adjusts the styling of the second part of
> the split.


Yes, I had some insights in the handling of commands when looking at this,
and rewrote that bit to be much nicer, and also now handle the _srflcmds,
which I had completely missed before.
I added tests to exercise this (and the earlier split tests) into the new
test_table_inrowsplit.py, where I have also added your edge cases. I added
the current output of that file.


>   2) The cell split seems to have no lower limit. In most cases we would
> not want to leave a very small part of a table
>
>      at the end of a page so presumable we would only want to split a row
> if it exceeds a specific height. That would
>      normally be the height of a frame or page. My guess is we could
> adjust this patch to use the value of splitInRow as
>      a suitable lower limit on row height for splitting.


So, the minimal "split height" will be one row of text for text cells, and
whatever the flowable wants for flowables. We can use splitInRow for that
as well. I now implemented it slightly differently, the splitInRow value
will be used for a minimum "end of table" height, so that we don't get just
one row of a table on a separate page. I think that's called an "orphan"
when it comes to paragraphs, right? I don't know if you think that makes
sense, I can change it to just be a general minimum of a cell.


> Untested
>    1) I guess this has not been tested at all with spanned rows/columns,
> but I haven't tried as yet.
>

I added a test for this.

   2) I haven't tried very long cells that would require two or more splits.
>

Added tests for this.

   3) I haven't checked to see if vertical alignment makes any real
> difference in split cells, but I think your
>       added test does show that it seems to do the right thing.
>

Yeah, it won't be pixel-perfect, I think, but at least something in the
vicinity.

// Lennart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20220307/d243b687/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: splitInRow-v4.diff
Type: text/x-patch
Size: 38360 bytes
Desc: not available
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20220307/d243b687/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_table_inrowsplit.pdf
Type: application/pdf
Size: 7597 bytes
Desc: not available
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20220307/d243b687/attachment-0001.pdf>


More information about the reportlab-users mailing list