#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2012
    Posts
    14
    Rep Power
    0

    Split a Page table across multiple pages while printing along with heading


    Hi all,
    I am printing a page with tables made up of div's using the ID by separate JavaScript function by passing the div's Id as Parameter to that function. What happens was , when we see the printed document, the rows of table are split across pages and data is half printed on each of them. the end row is splitted and it looks awkward. I need a way to split the row either to completely include in a page or to be split to next page. Along with that I need to print the heading of the table before the starting row of the next page as it would be easier for the reader to check upon what column corresponds to what data.
    For more clarity I have posted here my JavaScript code which prints the div based upon its ID.
    function printdiv(printarea)
    {
    var headstr = "<html><head><title></title></head><body>";
    var footstr = "</body>";
    var newstr = document.getElementById(printarea).innerHTML;
    var oldstr = document.body.innerHTML;
    document.body.innerHTML = headstr+newstr+footstr;
    window.print();
    document.body.innerHTML = oldstr;
    return false;
    }
    Please help if anyone has a solution for this
    Thanks
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,608
    Rep Power
    278
    I did that, and it is not easy. I did not use javasript I set up 2 style sheets something like
    <link rel="stylesheet" type="text/css" href="mainStylesScreen.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="MainStylesPrint.css" media="printer">
    which was div PrintOnly defined, so it has display:none in mainStylesScreen.css and what ever you need in MainStylesPrint.css
    and the opposite div DisplayOnly
    So you build your page and insert divisions in order you need and in PrintOnly div use {page-break-after:always}
    it is easy part. Complicated part is calculate in asp page size and where dynamically insert that div's. Remember on page break you need close table before page-break-after:always and open on new page...
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2012
    Posts
    14
    Rep Power
    0
    Hi GK,
    Can you explain me in a more clearer way..with a sample example? Please do it as it would be helpful for me to interpret to my scenario

Similar Threads

  1. Splitting a Page across pages along with heading
    By Pavanlalit in forum HTML, JavaScript And CSS Help
    Replies: 0
    Last Post: November 5th, 2012, 12:44 PM
  2. Printing multiple pages on a report
    By mellowyellow in forum Microsoft Access Help
    Replies: 9
    Last Post: February 13th, 2008, 10:21 AM
  3. Replies: 1
    Last Post: March 31st, 2006, 10:10 AM
  4. Printing Table from Asp page
    By sushestvo in forum ASP Development
    Replies: 6
    Last Post: October 28th, 2005, 10:06 AM
  5. Replies: 1
    Last Post: May 29th, 2000, 03:22 AM

IMN logo majestic logo threadwatch logo seochat tools logo