• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

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

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
ndhai
Asked:
ndhai
  • 2
  • 2
  • 2
  • +1
2 Solutions
 
RoonaanCommented:
have you tried: document.write();

-r-

0
 
RoonaanCommented:
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
 
COBOLdinosaurCommented:
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
Technology Partners: 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!

 
ndhaiAuthor Commented:
@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
 
James RodgersWeb Applications DeveloperCommented:
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
 
ndhaiAuthor Commented:
Hello
I amnot agree because there is no answer for me upto now :(
I am still trying the good anwser
ndhai
0
 
COBOLdinosaurCommented:
>>> 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now