Search code examples
.netvb.netvisual-studio-2010printing-web-page

Print HTML table in .NET with table header at start of each page


I would like to print an HTML file that I am generating myself, but I want the pages to have the same table header at the start of each page.

I think the best options to print an HTML file is the webbrowser control? but this won't give the table header at the start of each page (and I will have to contend with the ugly file://c:\temp\file.htm at the top of each page etc)

I guess I could use the print document control but I will have to manually add the table lines and work out the padding etc.


Solution

  • There is a CSS property page-break-before that might help you out but it is unreliable within a table so you might have to use a seperate table for each row or use div layers for it to work.

    Its not optimal but We used it in one occation.

    the principle is that it triggers if the renderer detects that the page break would occur within the element.