0

I would like to print my table that contains a lot of columns.

The way I am doing it is like below

function PrintPlanning() 
{
    var data = $('#planning').html();
    var mywindow = window.open();
    mywindow.document.write('<html><head><title>Planning</title>');
    mywindow.document.write('<link type="text/css" rel="stylesheet" href="/print.css"/>');
    mywindow.document.write('</head><body>');
    mywindow.document.write('<div id="planning">');
    mywindow.document.write(data);
    mywindow.document.write('</div>');
    mywindow.document.write('</body></html>');

    mywindow.print();

    return true;
}

My table is like this and is very large.

<div id="planning">
    <table>
        ...
    </table>
</div>

When I launch the function, the print overview appears but my table is fit on the width page and the content becomes very small (not readable).

Is it possible to extends it horizontally on new pages? Maybe with CSS?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Loric
  • 1,678
  • 8
  • 28
  • 48
  • [Answered before.](http://stackoverflow.com/questions/13684128/print-in-landscape-format) – Andy Aug 20 '13 at 13:15
  • Write a css for planning like that; #planning{ //css attributes here... } – Tugrul Aug 20 '13 at 13:17
  • Thanks. I saw this before but my table can also contains several lines. So if I set it to landscape, this is lines that will become small no? – Loric Aug 20 '13 at 13:18
  • @tgrll, is there a way to say to break tables in css? – Loric Aug 20 '13 at 13:24
  • You say that, you have so many columns, because of that your fonts are so small, don't you ? – Tugrul Aug 20 '13 at 13:27
  • add some jsfiddle please – gen Aug 20 '13 at 13:30
  • @tgrll, yes the fonts are small. My columns represents the days of the year so that's why it's large. – Loric Aug 20 '13 at 14:09
  • I don't know of any way to make a table fit both horizontally AND vertically. Think one of the 2 axis'es needs to fit on the page, however small the font may be. What you can do, is giving your table a completely different layout/display with a CSS print mediaquery. E.g. float some elements to display them horizontally instead of vertically, etc. Reference: my experience with a similar problem. – webketje Aug 20 '13 at 15:17
  • Try calendar components instead of displaying all days of the year. – Tugrul Aug 21 '13 at 05:06
  • I want to display very special data in my table and I thought to use a calendar component but it is not appropriate for what I need. I will throw a eye on the particular css layout for the printing, thanks. – Loric Aug 23 '13 at 06:26

0 Answers0