-
Notifications
You must be signed in to change notification settings - Fork 331
Fix: Support rowspans breaking over page jumps (#1460) #1694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
andersonhc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add some tests for your feature?
/test/table/test_table.py should be the best place for it - and you can use the current tests there as inspiration
| # Modification pour issue #1460 : On autorise le dépassement de page | ||
| # if ( | ||
| # page_break | ||
| # and self._fpdf.y + pagebreak_height > self._fpdf.page_break_trigger | ||
| # ): | ||
| # # Restoring original position on page: | ||
| # self._fpdf.x = prev_x | ||
| # self._fpdf.y = prev_y | ||
| # self._fpdf.l_margin = prev_l_margin | ||
| # raise ValueError( | ||
| # f"The row with index {i} is too high and cannot be rendered on a single page" | ||
| # ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete the commented code block
We don't keep dead code in the repository - git history is good enough if we ever need to recover old code
|
|
||
| # Continue to the next cell | ||
| continue | ||
| # --- END MODIFICATION --- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove # --- START MODIFICATION / END MODIFICATION comments
Reserve comments for pieces of code you believe are complicated enough to warrant the additional information
|
Hi @Neyhlo Without any answer from you, we will soon close this PR. |
Fixes #1460 ---
What changes are being made?
This PR fixes a bug where tables containing large vertically spanned cells (
rowspan) would crash when exceeding the page height, and allows them to break across pages cleanly.Key changes:
ValueErrorcheck inTable.render()that prevented long rows from rendering is removed._get_span_origin) and logic in_render_table_rowto draw the vertical borders for spanned cells on continuation pages (the "ghost borders").Checklist:
A unit test is covering the code added / modified by this PR
(Note: We verified this by running existing
rowspantests which fail without the fix.)In case of a new feature, docstrings have been added, with also some documentation in the
docs/folder (N/A, this is a bug fix/enhancement to existing feature)This PR is ready to be merged
Additional comments:
The change in functionality requires updating several golden PDF files in the test suite. Specifically, tests in
test_table_rowspan.pyandtest_table_padding.pyfail because the visual output now includes the vertical borders on continuation pages, which changes the MD5 hash.The reference files (golden files) need to be updated to match the new, correct behavior.
By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.