Skip to content
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

Tables not rendered correctly when they should have moved to next page #1001

Closed
mattieusch opened this issue Nov 30, 2019 · 1 comment
Closed
Labels
bug Existing features not working as expected
Milestone

Comments

@mattieusch
Copy link

mattieusch commented Nov 30, 2019

I think i've ran into a bug: when a table does not fit on one page anymore, it is not moved correctly to the next page. Instead, it's height and width is reduced to almost zero, leaving just a small bar. See the PoC below:

<!DOCTYPE html>
<html>
<body>
  <div style="height: 22cm; background-color: green;"></div>
  <p>div: 22cm - Before table</p>
  <table style="background-color: red;">
    <thead>
      <tr>
        <td>xx</td>
      </tr>
      <tr>
        <td>xx</td>
      </tr>
      <tr>
        <td>xx</td>
      </tr>
    </thead>
  </table>
  <p>After table</p>
</body>
</html> 

Case 1: when the first div is small enough to leave sufficient room for the table, everything renders correctly. (div height = 21cm or lower)

Case 2: when the div this so large that it pushes the 'Before table' text to the next page, everything renders correctly (div height = 25 or more).

Case 3: when the div's height leave enough room for the 'Before table' text but not for the (entire) table, the table is not rendered correctly. (22cm - 24 cm).

I've noticed this behavior in WeasyPrint 43 - 50 (didn't check all intermediary versions though).
21cm_ok
22cm_nok
24cm_nok
25cm_ok

@Tontyna
Copy link
Contributor

Tontyna commented Dec 6, 2019

Replacing <thead>/</thead> with <tbody>/</tbody> renders the three rows and spreads them across the page margins as expected.

Another case of WeasyPrint trying to avoid orphans and widows, cf. #978 and #979.

@liZe liZe added the bug Existing features not working as expected label Dec 15, 2019
@grewn0uille grewn0uille added this to the 51 milestone Dec 20, 2019
@liZe liZe closed this as completed Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

No branches or pull requests

4 participants