I have a page that spits out db data in long horizontal tables.
I need to print it nicely so it does not cut off. Any tips ?
In order to prevent a table to be split in several pages it is required to apply the page-break-inside and page-break-after styles to all of its contents. This trick works unless the table occupies more space than a full page.
tl;dr - To speed up loading a large HTML table on the client, start with the table CSS set to display: none; . Once the document is ready, set it back to display: table; . This reduced my client-side render time from 60 seconds to 6 seconds on a table with ~400,000 cells.
Print media, as you know is one of them. Print media is one of the oldest and basic forms of mass communication. It includes newspapers, weeklies, magazines, monthlies and other forms of printed journals. A basic understanding of the print media is essential in the study of mass communication.
document. write('<html><head><title>Table Contents</title>'); //Print the Table CSS. var table_style = document.
Change table into horizontal one with many rows (swap rows/columns)
Suggest users to switch to Landscape mode. AFAIK there's no way to do that programmatically in current browsers (CSS3 defines @page {size:landscape}
)
Split table every few columns (i.e. instead one with 100 columns, generate 10 tables with 10 columns each). Use CSS table {display: inline-table}
to show them all side-by-side on screen. This trick works only if you don't have cells with varying heights.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With