|
| |
|
|
Ruff
Posts: 132 Joined: 2/12/2004 From: Malta Status: offline
|
Page Break - 2/16/2005 3:18:54
FP2000 - ACCESS 2000 - WIN2000 Is it possible to insert a page break somewhere in the code to print database results? Some of my records tend to split on two pages, not because they are too long, but because they start at the bottom of one page and continue on the next. Is it also possible to have a headerand footer replicated on each page? Thanks
_____________________________
Tell me and I will forget. Involve me and I will understand.
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Page Break - 2/16/2005 10:12:56
For a printing page break I do this: 1. Put this code in the <HEAD> section: <style> p.page { page-break-before: always } </style> 2. Put this code wherever you want a page break: <p CLASS='page'> As to the repeating header and footer, I build each into a function. Then I determine how many records I can fit on a page. Once those are done, it's a relatively simple loop. 1. Header 2. Loop thru maxRecordsPerPage 3. Footer 4. Page Break 5. Repeat. I have a very big example of how I use this at http://www.clarkinsurance.com/cdonts_example.htm but it's only a small portion that concerns this topic. Look for the comments where it talks about building the page recursively. Hope it helps.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Ruff
Posts: 132 Joined: 2/12/2004 From: Malta Status: offline
|
RE: Page Break - 2/16/2005 10:59:27
Thanks .. the page break works fine. Now for the header and footer. Will give them a go. I understood what you are refering to and I don't think I should have any problem. Thanks again.
_____________________________
Tell me and I will forget. Involve me and I will understand.
|
|
|
|
Ruff
Posts: 132 Joined: 2/12/2004 From: Malta Status: offline
|
RE: Page Break - 2/16/2005 11:59:42
Works fine. Thanks :)
_____________________________
Tell me and I will forget. Involve me and I will understand.
|
|
|
|
hessfirm
Posts: 153 Joined: 9/15/2004 Status: offline
|
RE: Page Break - 7/13/2005 12:04:05
Hey there rdouglass. I am trying to accomplish what you and Ruff described in this thread...however I am much more of a novice.... I have a page, (sample below), that shows a header, main section, then a footer....the main section could be 1-50 records long....so it will cut a record in half when going to the next page. If I predetermined that the page should have the header, no more than 6 records in the main section, then the footer, how can i accomplish? I see your explanation worked for Ruff, i am not quite as savvy though. I am pasting a sample of this page below. I would be eternally grateful if you could help me figure this one out!!!! <body> (this is the header) <table> <tbody> <!--#include file="fpweb:///_fpclass/fpdblib.inc"--> <% if 0 then %> <SCRIPT Language="JavaScript"> document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>"); </SCRIPT> <% end if %> <% fp_sQry="SELECT * FROM Master WHERE (ID = ::ID::)" fp_sDefault="ID=" fp_sNoRecords="<tr><td colspan=1 align=left width=""100%"">No records returned.</td></tr>" fp_sDataConn="ANHDDedServer" fp_iMaxRecords=256 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="" fp_sMenuValue="" fp_iDisplayCols=1 fp_fCustomQuery=False BOTID=0 fp_iRegion=BOTID %> <!--#include file="fpweb:///_fpclass/fpdbrgn1.inc"--> <tr> <td> <p align="center"><img border="0" src="../images/Advertisers/<%=FP_FieldLink(fp_rs,"BrochureLogo")%>"></td> </tr> <!--#include file="fpweb:///_fpclass/fpdbrgn2.inc"--> </tbody> </table> (this is the main section) <table> <tbody> <!--#include file="fpweb:///_fpclass/fpdblib.inc"--> <% if 0 then %> <SCRIPT Language="JavaScript"> document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>"); </SCRIPT> <% end if %> <% fp_sQry="SELECT * FROM Homesmaster WHERE (ID = ::ID::)" fp_sDefault="ID=" fp_sNoRecords="<tr><td colspan=1 align=left width=""100%"">No records returned.</td></tr>" fp_sDataConn="ANHDDedServer" fp_iMaxRecords=256 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="" fp_sMenuValue="" fp_iDisplayCols=1 fp_fCustomQuery=False BOTID=1 fp_iRegion=BOTID %> <!--#include file="fpweb:///_fpclass/fpdbrgn1.inc"--> <tr> <td> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber64" width="564"> <tr> <td align="right" valign="top" width="82" height="16"> <p style="margin-right: 5"><font color="#140F71"><span style="font-weight: 700; font-size: 9pt">MLS#</span><span style="font-size: 9pt; font-weight: 700">:</span></font></td> <td valign="top" width="134" height="16"> <span style="font-size: 9pt"><%=FP_FieldVal(fp_rs,"Ln")%></span></td> <td valign="top" align="right" width="64" height="16"> <p style="margin-right: 5; margin-top: 0; margin-bottom: 0"><font color="#140F71"><span style="font-weight: 700; font-size: 9pt">Stories:</span></font></td> <td valign="top" width="284" height="16"> <span style="font-size: 9pt"> <%=FP_FieldVal(fp_rs,"Sto")%></span></td> </tr> <tr> <td align="right" valign="top" width="82"> <p style="margin-right: 5; margin-top: 8"><font color="#140F71"><span style="font-weight: 700; font-size: 9pt">Remarks:</span></font></td> <td colspan="3" valign="top" width="482"> <p style="margin-top: 8; margin-bottom: 0"><span style="font-size: 9pt"><%=FP_FieldVal(fp_rs,"R3")%></span><p CLASS='page'></td> </tr> </table> </center> </div> </td> </tr> <!--#include file="fpweb:///_fpclass/fpdbrgn2.inc"--> </tbody> </table> (This is the footer) <div align="left"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="600"> <tr> <td>this could be the footer</td> </tr> </table> </div> </body>
_____________________________
Steve Hess
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Page Break - 7/13/2005 14:12:59
quote:
I have a very big example of how I use this at http://www.clarkinsurance.com/cdonts_example.htm but it's only a small portion that concerns this topic. Did you take a look at that link I posted? It doesn't have a DRW in it at all. I suspect I could do it using the DRW but it would be a huge hack. The basic premise to do this is as follows: 1. Write header to browser 2. Write as many records as you deem appropriate to 1 page. 3. Write footer 4. Write page break 5. Go to 1. This is a good example as to where the DRW shows it's limitations. If I was going to try and use a DRW, I would do something like this: 1. Put *all* header info into a variable. 2. Put *all* footer info into a different variable. 3. Make the DRW look something like so: <!--#include file="fpweb:///_fpclass/fpdbrgn1.inc"--> <%IF fp_iCount MOD 6 = 0 THEN Response.write(pageHeaderVariable & "<table>") END IF%> <tr> <td> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber64" width="564"> <tr> <td align="right" valign="top" width="82" height="16"> <p style="margin-right: 5"><font color="#140F71"><span style="font-weight: 700; font-size: 9pt">MLS#</span><span style="font-size: 9pt; font-weight: 700">:</span></font></td> <td valign="top" width="134" height="16"> <span style="font-size: 9pt"><%=FP_FieldVal(fp_rs,"Ln")%></span></td> <td valign="top" align="right" width="64" height="16"> <p style="margin-right: 5; margin-top: 0; margin-bottom: 0"><font color="#140F71"><span style="font-weight: 700; font-size: 9pt">Stories:</span></font></td> <td valign="top" width="284" height="16"> <span style="font-size: 9pt"> <%=FP_FieldVal(fp_rs,"Sto")%></span></td> </tr> <tr> <td align="right" valign="top" width="82"> <p style="margin-right: 5; margin-top: 8"><font color="#140F71"><span style="font-weight: 700; font-size: 9pt">Remarks:</span></font></td> <td colspan="3" valign="top" width="482"> <p style="margin-top: 8; margin-bottom: 0"><span style="font-size: 9pt"><%=FP_FieldVal(fp_rs,"R3")%></span><p CLASS='page'></td> </tr> </table> </center> </div> </td> </tr> <%IF (fp_iCount + 1) MOD 6 = 0 THEN Response.write("</table>" & pageFooterVariable & "<p CLASS='page'>") END IF%> <!--#include file="fpweb:///_fpclass/fpdbrgn2.inc"--> or something to that effect. See, I'm using fp_iCount to determine every 6th record and in turn that determines if the page header, footer, and break needs to be written. That help any?
< Message edited by rdouglass -- 7/13/2005 22:21:41 >
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
dupati1
Posts: 84 Joined: 10/6/2003 Status: offline
|
RE: Page Break - 7/13/2005 17:25:18
Sir, i also need some help related to this page break thing...i have this following code there i am creating a table dynamically populating with the data from the database...i am displaying the data in 3 columns and multiple rows depending on the size of the data..i mean i am restricting the number of columns to 3...
<table cellspacing="2" cellpadding="20" border="1" width="100%">
<%
count = 0
myMod = 0
do while not rsObj.EOF
myMod = count mod 3
if (myMod = 0) then Response.Write "<tr>"
Response.Write "<td align=""center"" width=""35%"">" & rsObj("AccountNumber") & " </td>"
if (myMod = 2) then Response.Write "</tr>"
count = count + 1
rsObj.MoveNext
loop
select case myMod
case 0
Response.Write "<td> </td><td> </td></tr>"
case 1
Response.Write "<td> </td></tr>"
case 2
end select
%>
</table>
i want to do a page break after every 10 rows...because each page can only fit 10 rows correctly... how can i do that.... thanks in advance...
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Page Break - 7/13/2005 21:30:21
quote:
i want to do a page break after every 10 rows I think this will do it. First put this in the <head> section: <style> p.page { page-break-before: always } </style> Then change your code here: ... do while not rsObj.EOF myMod = count mod 3 if (myMod = 0) then Response.Write "<tr>" Response.Write "<td align=""center"" width=""35%"">" & rsObj("AccountNumber") & " </td>" ... to this: ... do while not rsObj.EOF myMod = count mod 3 IF (count + 1) MOD 30 = 0 THEN%> </table> <p CLASS='page' align='center> </p> <table cellspacing="2" cellpadding="20" border="1" width="100%"> <%END IF if (myMod = 0) then Response.Write "<tr>" Response.Write "<td align=""center"" width=""35%"">" & rsObj("AccountNumber") & " </td>" ... See, what I'm doing is for every 10th line (3 records per line so every 30th record) I'm closing the table, inserting a page break, and starting a new table. Haven't tested the syntax but it should be very close. Hope it helps.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
dupati1
Posts: 84 Joined: 10/6/2003 Status: offline
|
RE: Page Break - 7/14/2005 8:59:50
ok this one did the trick: IF (count) MOD 30 = 0 THEN%> Thanks so much how do i suppress headers and footers while printing
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Page Break - 7/14/2005 9:07:47
quote:
how do i suppress headers and footers while printing Can you explain that a little more?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
dupati1
Posts: 84 Joined: 10/6/2003 Status: offline
|
RE: Page Break - 7/14/2005 9:10:32
i mean i dont want to print headers and footers ...i just want the plain document printed which has just the database results.. -thanks
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Page Break - 7/14/2005 11:46:16
If you put just the code you posted and the change that I suggested as well as any DB connector stuff on a page by itself, it should output just the results. If that doesn't make any sense, post the page code you have and I'll show you what I mean.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
dupati1
Posts: 84 Joined: 10/6/2003 Status: offline
|
RE: Page Break - 7/14/2005 13:51:50
oh no...i mean to say that i am showing this table on a html page... so when i print it...i get the headers and footers of the HTML page getting printed... i mean the title name, date, url, page number are getting printed which i dont want...
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Page Break - 7/14/2005 14:04:02
quote:
If you put just the code you posted and the change that I suggested as well as any DB connector stuff on a page by itself, it should output just the results. There's the key. The stuff I'm providing doesn't creat a 'printer freindly' page. Rather it just inserts printing pagebreaks in the doc. If you don't want headers and footers at all, you might be able to do something like this: Put a button or link on your page that says "Print These Records" or something to that effect. Create a new page that has just the DB connector, the table-generating code you provided, and my script additions. No header or footer info on that page at all. Point the button or link to this new page. I guess my point is that this script does *not* define what prints or what doesn't. It just defines where a prinitng page break should be. That any help?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
dupati1
Posts: 84 Joined: 10/6/2003 Status: offline
|
RE: Page Break - 7/14/2005 14:09:06
ok ok...got the point now... thanks so much for the info.
|
|
|
|
dupati1
Posts: 84 Joined: 10/6/2003 Status: offline
|
RE: Page Break - 7/18/2005 13:57:11
thanks..thats not a problem..i have one more question...i have something like this on my page... <style> <!-- div.Section1 {page:Section1;} p.MsoNormal {mso-style-parent:""; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman"; margin-left:0in; margin-right:0in; margin-top:0in} p.page { page-break-before: always } --> </style> and i am using it like this: <body> <div class="Section1"> writing table here and so on.. and when i put... <p CLASS='page' align='center> </p> the page break is not working...is the Section1 class overriding the page Class properties... ?? Thanks in advance...
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Page Break - 7/18/2005 15:31:21
It might be but I'm not sure. You may have to make it do something like: ... IF (count + 1) MOD 30 = 0 THEN%> </table> </div> <p CLASS='page' align='center> </p> <div class="Section1"> <table cellspacing="2" cellpadding="20" border="1" width="100%"> <%END IF ... What I'm doing is closing the DIV first, putting in the PAGE class then opening a new DIV. This is purely just a guess 'cause I'm no expert on styles / CSS and I really don't know for sure.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
ahaynes106
Posts: 7 Joined: 8/1/2005 Status: offline
|
RE: Page Break - 8/17/2005 22:55:23
Hey guys. Don't mean to interupt, but I got the page break thing printing fine in IE, but the page break won't work when printing from Mozilla Firefox. Ever run into that?
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|