Project

General

Profile

Defect #816

Print table header on each page

Added by Jos de Bruijn almost 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
07/09/2014
Due date:
% Done:

0%

Estimated time:
Browser (if web client):
Chrome 35.0.1916.153

Description

Not sure if this is a bug, or if I'm doing something wrong.
I've got a velocity report that has to generate a PDF file.
The report is basically a single html table, and I want the header to repeat on each page.
I think I've got the html correct but it is not working.
I've added a thead and tbody to the table and added the following to the style:
thead {display: table-header-group;}
tbody{ display:table-row-group;}

I've included the report as it is generated by velocity


Files

report.html (39.4 KB) report.html Jos de Bruijn, 07/09/2014 10:58 AM
report_organisation.html (4.79 KB) report_organisation.html velocity template Jos de Bruijn, 07/11/2014 12:14 PM
files.zip (30.2 KB) files.zip Jos de Bruijn, 07/15/2014 10:27 AM

History

#1

Updated by Patrick Talbot almost 10 years ago

thead {display: table-header-group;}
tbody{ display:table-row-group;}
is not supported CSS.

try this instead:
table {
-fs-table-paginate: paginate;
}

#2

Updated by Jos de Bruijn almost 10 years ago

That also does not repeat the header on all pages, and as a side-effect it adds a margin to all table cells
I've tried to include the generated pdf file, but this does not show up in the issue. I can mail it if you like.

#3

Updated by Patrick Talbot almost 10 years ago

The html files are not accessible. Please zip your files (including the pdf) and attach them.

I just tried -fs-table-paginate: paginate; and yes, it nulls table-collapse: collapse (which is a known bug), but it works in my case.

You could also alternatively try a running header.

div.header { display: none }
div.header { display: block; position: running(header); }

@page {
    size: letter portrait;
    @top-left { content: element(header); }
}

Then have a div with some repeated content. Problem is that you would have to have fixed width in your columns then.

But -fs-table-paginate: paginate; should work for thead in tables.

#4

Updated by Jos de Bruijn almost 10 years ago

Files added

#5

Updated by Patrick Talbot almost 10 years ago

Could you include the filled report?

#6

Updated by Patrick Talbot almost 10 years ago

Looking quickly at the template, I see you didn't define a <thead> around the <tr><th> and a <tbody> around the rest.
If you add that it should work

#7

Updated by Patrick Talbot almost 10 years ago

Does this work with thead and tbody correctly set? Please report.

#8

Updated by Jos de Bruijn over 9 years ago

Sorry it took so long to reply.
Adding the thead and tbody does indeed repeat the header on all pages.
Now I only need to find a workaround for the margins around the cells.

#9

Updated by Patrick Talbot over 9 years ago

  • Status changed from New to Closed

Also available in: Atom PDF