JavaScript and client side scripting.
Moderator: General Moderators
-
gurjit
- Forum Contributor
- Posts: 314
- Joined: Thu May 15, 2003 11:53 am
- Location: UK
Post
by gurjit »
I have a table which is "1700px"
I want to print this table in "landscape" and when it comes to the end of the page print the rest on another sheet.
How can i do this?
At the moment the page only prints as much as it can on a page.
In the example below it will only print to "row 6" and leave the rest. I want "row 7" onwards on the next page.
Code: Select all
<table border="0" width="1700" cellspacing="0" cellpadding="0">
<tr>
<td>row 1</td>
<td>row 2</td>
<td>row 3</td>
<td>row 4</td>
<td>row 5</td>
<td>row 6</td>
<td>row 7</td>
<td>row 8</td>
<td>row 9</td>
<td>row 10</td>
<tr>
<tr>
<td>row 1</td>
<td>row 2</td>
<td>row 3</td>
<td>row 4</td>
<td>row 5</td>
<td>row 6</td>
<td>row 7</td>
<td>row 8</td>
<td>row 9</td>
<td>row 10</td>
<tr>
</table>
-
feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Post
by feyd »
sounds like it's working as you want it...

-
CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
Post
by CoderGoblin »
You could imbed some CSS into your code...
Code: Select all
<style>
@media print { tr.pagebreak {page-break-before: always}}
</style>
and in your main table
Code: Select all
<tr class="pagebreak"><td>xxxxxx</td><td>lkjlkjl</td></tr>
This should work if you know how many rows per page you will need (I believe, haven't ever tested).
Another alternative is to convert the HTML into another format for printing (e.g.PDF) and print that.
-
wwwapu
- Forum Contributor
- Posts: 197
- Joined: Wed Apr 07, 2004 11:57 am
- Location: Turku, Finland
Post
by wwwapu »
I wasn't quite sure what you wanted, but here is one suggestion
Code: Select all
table{
width: 1700px;
}
@media print{
body{
margin: 0;
}
table{
width: 255mm;
}
td{
width: 25.5mm;
}
}
print width estimated 255 because I have 19,05 pagemargins in IE
-
gurjit
- Forum Contributor
- Posts: 314
- Joined: Thu May 15, 2003 11:53 am
- Location: UK
Post
by gurjit »
Is there anyway I can break the <td>
for example
Code: Select all
<table border="0" width="1700" cellspacing="0" cellpadding="0">
<tr>
<td>row 1</td>
<td>row 2</td>
<td>row 3</td>
<td>row 4</td>
<td>row 5</td>
<td>row 6</td>
<div style="page-break-before:always"></div>
<td>row 7</td>
<td>row 8</td>
<td>row 9</td>
<td>row 10</td>
<tr>
<tr>
<td>row 1</td>
<td>row 2</td>
<td>row 3</td>
<td>row 4</td>
<td>row 5</td>
<td>row 6</td>
<div style="page-break-before:always"></div>
<td>row 7</td>
<td>row 8</td>
<td>row 9</td>
<td>row 10</td>
<tr>
</table>
Do I have to break at <tr>?