Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

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

Results 1 to 3 of 3
Share This Thread →
  1. #1
    Pavanlalit is offline Registered User
    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
    gk53's Avatar
    gk53 is offline Contributing User
    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,535
    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

  3. #3
    Pavanlalit is offline Registered User
    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

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

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, 11:44 AM
  2. Printing multiple pages on a report
    By mellowyellow in forum Microsoft Access Help
    Replies: 9
    Last Post: February 13th, 2008, 09:21 AM
  3. Replies: 1
    Last Post: March 31st, 2006, 09:10 AM
  4. Printing Table from Asp page
    By sushestvo in forum ASP Development
    Replies: 6
    Last Post: October 28th, 2005, 09:06 AM
  5. Replies: 1
    Last Post: May 29th, 2000, 02:22 AM

ASP Free Advertisers and Affiliates