Solved

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

Posted on 2004-10-13
8
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…
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…

691 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