Link to home
Start Free TrialLog in
Avatar of ndhai
ndhai

asked on

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
Avatar of Roonaan
Roonaan
Flag of Netherlands image

have you tried: document.write();

-r-

ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ndhai
ndhai

ASKER

@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
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
Avatar of ndhai

ASKER

Hello
I amnot agree because there is no answer for me upto now :(
I am still trying the good anwser
ndhai
>>> 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&