- Total Members: 220,321
- Threads: 525,398
- Posts: 977,016
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.
-
November 5th, 2012, 11:46 AM
#1
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
-
November 5th, 2012, 02:59 PM
#2
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 scale

(right side on this reply ) and agree
-
November 5th, 2012, 04:20 PM
#3
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
-
By Pavanlalit in forum HTML, JavaScript And CSS Help
Replies: 0
Last Post: November 5th, 2012, 11:44 AM
-
By mellowyellow in forum Microsoft Access Help
Replies: 9
Last Post: February 13th, 2008, 09:21 AM
-
By gokulin in forum ASP Development
Replies: 1
Last Post: March 31st, 2006, 09:10 AM
-
By sushestvo in forum ASP Development
Replies: 6
Last Post: October 28th, 2005, 09:06 AM
-
By Steve Schofield in forum ASP Development
Replies: 1
Last Post: May 29th, 2000, 02:22 AM