Table Header with several rows and Footer
Hi.
I tried to reopen a related issue which is closed, but didn't seem to work, so here I am.
I have a table with header made of two rows. I want both rows to be exported as part of the header, with same style. Currently only the last header row is exported.
I have updated you basic table from the sample. Note that the color display down here is not correct as both row headers should be displayed the same way.
On top of that, the table footer <tfoot>...</tfoot> does not seem to be exported at all
Thanks in advance for your quick feedback.
Have you tried using the hooks? It might be a bit tricky but should be possible both having two rows as header and to add a footer. Lets keep this issue open as a feature request though. How would you like the api to look like for this?
I haven't figured out a way to do it properly with the hooks.
Would make much more sense to include it as default. Doesn't sound too complicated. I would replace the property headerRow:Row with headerRows:Row[].
The headerRow is used to defined the columns of the table, so you can keep doing that by using the last header row of the array. And on top of that you add all previous rows as defined in original table.
In order to not have any breaking changes you can check the headers parameter which is provided and create a single or multiple row array.
For footer, just grab the <tfoot> from the original table if there is one and add it as is in the generated table...
What do you think?
Sounds good, will probably make it that way when and if it is implemented. Feel free to submit a PR for it.
If want pointers to how to draw multiple headers, I made an example a while back here: http://stackoverflow.com/a/35382414/827047. Basically what I did was first increasing the height of the default header, then simply draw the secondary header in the space that was freed because of it.
Here is a jsfiddle: https://jsfiddle.net/someatoms/tbz8p79j/6/ The pdf ends up something like this:

Thanks for the details. It looks good except some css details cause it almost look like a regular row with the alternate colors.
You should just be able to set the fill color to the same blue to achieve the same styling.
Support for multiple headers and footers now in master. Will be released in version 3.0.
Is there a timeline for for when 3.0 will be released?
In a few days hopefully!