943,712 Members | Top Members by Rank

Ad:
Oct 15th, 2008
0

Regarding Pagebreaks

Expand Post »
Hai,
I've read about "page-break-inside" style and it seems to be
exactly what I need. I am working on some report printings, and I need
specific table to be printed on following page if it does not fit in the
current one. Unfortunatelly, I cannot solve this issue... Does
page-break-inside not work? I have made some tests on IE 7.0 and it
simply does nothing. How should I use this style?... Here is my code:

<table style="page-break-inside:avoid;">
<tr>
<td align="center" valign="middle">31</td>
<td align="center" valign="middle">32</td>
<td align="center" valign="middle" id="cell3">33</td>
<td align="center" valign="middle" id="cell1">13</td>
</tr>
</table>

Can you help me?
Thank you very much!

Seetha
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
asp_seetha is offline Offline
7 posts
since Oct 2008
Oct 18th, 2008
0

Re: Regarding Pagebreaks

Click to Expand / Collapse  Quote originally posted by asp_seetha ...
I need specific table to be printed on following page if it does not fit in the current one. Unfortunatelly, I cannot solve this issue... Does page-break-inside not work? I have made some tests on IE 7.0 and it simply does nothing. How should I use this style?
Well you can not take a decision at run time that whether the table will fit on the page or not. So you can use any of the CSS property page-break-after, page-break-before or page-break-inside to insert page breaks. So either you will have to put page break at the beginning of the table of at the end of the table and you can not predict whether it should be before or after the table.
Reputation Points: 9
Solved Threads: 1
Junior Poster in Training
msaqib is offline Offline
91 posts
since Sep 2004
Oct 25th, 2008
0

Re: Regarding Pagebreaks

Hai

Thanks for the support.

BUt Im creating dynamic tables. The tables are not fixed size. One page may contain two or more tables. That is not specified in the program code. I cannot set page break before or after the tables, If I set means each table will print in one page. I dont want like that. If the table is not fit to the page, automatically it should go to the next page. I am using pagebreakinside in CSS. But it is not working... Any other way.

Thanks

Seetha
Reputation Points: 10
Solved Threads: 0
Newbie Poster
asp_seetha is offline Offline
7 posts
since Oct 2008
Oct 26th, 2008
0

Re: Regarding Pagebreaks

Hi,
dynamic width and dynamic number of tables is not possible, just as msaqib said, you have to make the decision about the page break before you put the style into css.

If you want to make both table width and page breaks dynamic, then you have to take a greater step, and make some calculation:

1. Define the width of the page
2. Define font size
3. Get approx. width of each character in that specific font size (width of i and width of w / 3 * 2).
4. Define the margins and paddings
5. Make calculation of the achieved width during page generation by:
counting characters, multiplying with average font-width, add margin and padding, set as achieved width of table.

Now prior to sending the whole stuff to the browser, you have to put the whole text into variables, so that you can calculate whether the next table fits in the space between the last table and the edge of the page.

If the table fits into the space, then put it there, else simply add a page break before the table.

This is a little complicated and takes time, but it's possible.

Good luck.
Reputation Points: 11
Solved Threads: 7
Junior Poster in Training
Baradaran is offline Offline
88 posts
since Feb 2007
Nov 3rd, 2008
0

Re: Regarding Pagebreaks

Thank you much. Now I am having clear idea. I will try this and reply back
Reputation Points: 10
Solved Threads: 0
Newbie Poster
asp_seetha is offline Offline
7 posts
since Oct 2008
Nov 19th, 2008
0

Re: Regarding Pagebreaks

Moderators need to move this to the CSS forum because i don't see how this fits into ASP.
Reputation Points: 25
Solved Threads: 7
Junior Poster
Drew is offline Offline
166 posts
since Apr 2004
Nov 23rd, 2008
0

Re: Regarding Pagebreaks

Make the decision at print time by selecting the table, and then print only the selection.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Nov 25th, 2008
0

Re: Regarding Pagebreaks

The tables are not fixed size. One page may contain two or more tables. That is not specified in the program code. I cannot set page break before or after the tables, If I set means each table will print in one page. I dont want like that. If the table is not fit to the page, automatically it should go to the next page. I am using pagebreakinside in CSS. But it is not working... Any other way.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mamon003 is offline Offline
3 posts
since Nov 2008
Nov 26th, 2008
0

Re: Regarding Pagebreaks

Not all printers are created equally.

You are having problems because the printer is not controlled by either the web browser or the html code. It is controlled by the printer driver that came with the printer. This function (and its settings) belongs to the owner of the computer rendering the page, not to you.

Your code can not know in advance how many lines the printer attached to the user's system can put on a page, or how the printer will lay out a table. It will be different if a user with a different printer opens the page. Just like different screen resolutions, there are different printer pixel resolutions.

So all of the rules that apply to different screens (and their disadvantages) also apply to different printers. Not only can't you know where the printer will break a page, you can't even know how large the printed page is, in terms of how much content fits on a page.

To get all of a table (or multiple tables) onto a page, the user should select the parts he wants to print, and then use Print Selection on the printer dialog box.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: I need help.
Next Thread in HTML and CSS Forum Timeline: Java applet behave as button link?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC