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

Paginated table header with border-collapse #97

Closed
Epimetheus89 opened this issue May 18, 2017 · 3 comments
Closed

Paginated table header with border-collapse #97

Epimetheus89 opened this issue May 18, 2017 · 3 comments

Comments

@Epimetheus89
Copy link

Epimetheus89 commented May 18, 2017

Currently using -fs-table-paginate: paginate; as css property on a table overwrites the border-collapse: collapse; property. This causes the border in a header line to have spaces between the cells:
screenshot from 2017-05-18 18-24-58
The reason for this can be found in this line:
https://github.com/danfickle/openhtmltopdf/blob/open-dev-v1/openhtmltopdf-core/src/main/java/com/openhtmltopdf/css/style/CalculatedStyle.java#L1152
Is it possible to fix that issue or is there another solution to have collapsed borders in a repeated header row of a table?

@danfickle
Copy link
Owner

Hi @Epimetheus89
I commented the second part of that line and table pagination with collapsed borders seems to work fine with my minimal example. See screenshot below. I'm somewhat confused as to why that second part is there but I'll comment it out so the onus is on the user to confirm that it works with their layout.

I'll also try to do a release for you. Thanks for finding the problematic line.

table-pagination-with-collapsed-borders

From this example:

<html>
<head>
<style>
@page {
  size:  200px 80px;
  margin: 0;
}
table {
	-fs-table-paginate: paginate;
	border-collapse: collapse;
	font-size: 16px;
}
td, th {
	border-bottom: 2px solid red;
}
</style>
</head>
<body>

<table>
  <thead>
    <tr><th>H1</th><th>H2</th></tr>
  </thead>
  <tbody>
    <tr><td>1</td><td>11</td></tr>
    <tr><td>2</td><td>12</td></tr>
    <tr><td>3</td><td>13</td></tr>
    <tr><td>4</td><td>14</td></tr>
    <tr><td>5</td><td>15</td></tr>
    <tr><td>6</td><td>16</td></tr>
    <tr><td>7</td><td>17</td></tr>
    <tr><td>8</td><td>18</td></tr>
    <tr><td>9</td><td>19</td></tr>
    <tr><td>10</td><td>20</td></tr>
  </tbody>
</table>

</body>
</html>

@rototor
Copy link
Contributor

rototor commented May 21, 2017

I just tested this with some rather complex multipage tables and it really seems to make no difference, i.e. this change does not break tables which had border-collapse:collapse specified, but also had table pagination activated. Strange, why was this disabled in the first place?

@Epimetheus89
Copy link
Author

Thanks for fixing this! I also took a look into the implementation and could not explain or think of a scenario in that this line would make any sense.
The issue can now be closed if you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants