Print Stylesheets for pages with long horizontal tables

Boris Smirnov picture Boris Smirnov · Nov 15, 2008 · Viewed 12.3k times · Source

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 ?

Answer

Kornel picture Kornel · Nov 16, 2008
  1. Change table into horizontal one with many rows (swap rows/columns)

  2. Suggest users to switch to Landscape mode. AFAIK there's no way to do that programmatically in current browsers (CSS3 defines @page {size:landscape})

  3. 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.