Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page breaks etc

Status
Not open for further replies.

marianmarian

Programmer
Jan 17, 2003
40
CA
Hello all,

i am trying to page break a data that is coming from the database to an html table; and i know i will need to use conditional statements such as if-else-statments to force a page break to happen, and someone was also suggestting that i count how many strings are being printed on a page.

To be able to go do the next step i wanted to know how does a document know when to page break if there is no page break specifications set?

thanks.
 
the page doesn't know...it's up to your particular printer and its settings.

you can force a page break using css:

page-break-before:always;

or

page-break-after:always;

e.g.
<div>blah blah blah...</div>
<span style="page-break-before:always;"></span>
<div>i will have a page break before me</div>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
thanks, but this doesn't solve my problem.

the thing is my data is coming from the database and it is being displayed on the web in an html table. so i don't know when to force a page break on the data as i don't know how many data is coming from the database. if there is more than two pages of data coming from the database, i will page break, but if not just print the one page document.

hope this explains more to my question.

thanks for all your responses

 
again, you won't know when a particular user's print settings will want to make a page break. what i've done in the past when creating database-driven reports is to determine a "safe" number of rows to render before inserting a page break via css.

specify a font size in pixels to help keep a consistent size across browsers, but you still can't prevent the user from having their own print preferences.


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
I am not trying to prevent a user from not having their own print preferences.

I guess i will need to explain what i am trying to do again.

So basically, i am trying to print data that is coming from a database nicely and neatly on a html table on the web. I have a header for each different set of tables that i am printing so say my data is schools:

so here is my table for school with its sub headers like this

Teachers
Students
etc..

So if when printing all of these information if it happened that there are more data for teachers in the database, instead of printing the rest of the data for teachers on the next page with no header, rather i want the rest of the data to be printed on the next page starting with a header.

and now comes my question, i don't know what the size of data teachers has in the database, so i don't know when to force my page break and start a new page with a header.

i am able to use "break always" etc only if data is static, that is if i know the size of my data, but in what i want to do, i have no clue of the amount of data in the database.

thanks for all your responses.
 
you'll just have to come up with a manual process of counting the number of rows you've displayed so far, and when you get to a certain amount of rows "break" the page and start a new table with headers etc...


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top