Solved

How to print well one table with window.print();

Posted on 2004-10-13
8
296 Views
Last Modified: 2012-05-05
Hi everybody,
I have a trouble when I print a table in HTML with function window.print();
For example, I have a big table following
<table border=1>
<tr><td> big data here ............................</td></tr>
<tr><td> big data here ............................</td></tr>
<tr><td> big data here ............................</td></tr>
--------------repeat many times here --------------
<tr><td> big data here ............................</td></tr>
<tr><td> big data here ............................</td></tr>
<tr><td> big data here ............................</td></tr>
</table>

So when I print it by javascript function window.print();, normally, there is one rows who is in 2 pages. Could I force to print this row in the next page and don't print it in the previous page ?

Thanks for your helps
Best regards
ndhai
0
Comment
Question by:ndhai
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 12298879
have you tried: document.write();

-r-

0
 
LVL 49

Accepted Solution

by:
Roonaan earned 25 total points
ID: 12298915
Drop that suggestion. Didn't look as close to the question as should.

And you could look at some css solution using http://www.w3schools.com/css/css_ref_print.asp. You could try to add
style="page-break-before:always;" to force a page break.
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 25 total points
ID: 12303483
Tables don't print well...actually web pages don't print well.  If the print quality is critical use a PDF.  You can also do formatting with activex controls, but I don't recommend those except for intranet apps.  Ths activex control is pretty widly used:

http://www.meadroid.com/scriptx/index.asp

Cd&
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:ndhai
ID: 12305749
@Roonaan

It doesn't work for your two solution
you could try with my table
<input type=button value=Print onclick="window.print();">

<table border=1 style="page-break-before:always;">
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
<tr><td> big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data <br>here ....<br>big data here ....<br>big data here ....<br>........................</td></tr>
</table>


@COBOLdinosaur: I am at Office and I will try with your solution
thanks in advance
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 13122206
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

Split between : COBOLdinosaur {12303483} & Roonaan {12298915}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Jester_48
EE Cleanup Volunteer
0
 

Author Comment

by:ndhai
ID: 13124053
Hello
I amnot agree because there is no answer for me upto now :(
I am still trying the good anwser
ndhai
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 13124481
>>> there is no answer for me upto now

What you want will require re-invention of the technology.  So until you write a new browser that does what you want, you have the answers available.  It does not matter how long you wait you are not going to get what you want; and it is long post the time when this should be closed.

Cd&
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now