HTML/CSS - Avoiding cell splitting when printing
I want to print an HTML table.
Unfortunately, when I do, cells (rows) are often cut between two pages. Also, browsers seem to trample over the page-break-inside property without any care, so that won't work.
The code in question:
<table>
<tr><td colspan="2">HEY YALL!</td></tr>
<tr><td>A!</td><td&g开发者_开发技巧t;B</td></tr>
</table>
Sorry -- I think there is no great way to go here -- the web still isn't made for printing.
One work-around for IE is to emulate version 8, so the page-break-inside: avoid
will work. There's also a bit about windows and orphans settings. More here: http://msdn.microsoft.com/en-us/library/dd433064%28v=vs.85%29.aspx
You can also look for HTML+CSS - to - PDF conferters. I've seen a lot of different implementations of that sort of thing.
One thing I've done in the past also is to change the content-type to .doc and stream the HTML out to MS Word (because that's what my users have, and Word can read HTML now.). This works OK.
精彩评论