johnhardy
asked on
Printing asp pages
Hello
I have a report in .asp from Dreamweaver
There is a repeat behaviour which shows 10 records, the next 10 appear on the next page and so on
Is there a way that I can get all of the records to print on their relative pages from a print command?
Thanks
John
I have a report in .asp from Dreamweaver
There is a repeat behaviour which shows 10 records, the next 10 appear on the next page and so on
Is there a way that I can get all of the records to print on their relative pages from a print command?
Thanks
John
You need to find the line of code on that page that says Repeat1_numRows = 10 and change the number to -1. That will list every record on one page.
ASKER
Thanks
To clarify a little (I hope) it is an asp page with a repeat behaviours within a table and yes a ctrl P will print what ever is showing on the page.
The repeating lines will print, but only the page that can be seen will print.
So if I have more that 10 lines the remainder will appear on the next page and so will not print.
I wonder if thats clearer?
I tried this in the table
<td><table style="page-break-before: always, width="740" border="0" cellspacing="0" cellpadding="0"> but it did not seem to make any difference.
To clarify a little (I hope) it is an asp page with a repeat behaviours within a table and yes a ctrl P will print what ever is showing on the page.
The repeating lines will print, but only the page that can be seen will print.
So if I have more that 10 lines the remainder will appear on the next page and so will not print.
I wonder if thats clearer?
I tried this in the table
<td><table style="page-break-before: always, width="740" border="0" cellspacing="0" cellpadding="0"> but it did not seem to make any difference.
ASKER
Thanks fuzzboxer:
If I set the repeat region to -1 it gives me all records that OK
However when the file prints the second (or third etc) page the second page will start halfway through a repeated line.
It would be good to get at least a complete repeated area and preferably the top of each page (a heading printed.
Maybe the following sketch will illustrate the idea
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------
| Heading information |
-------------------------- ---------- ---------- ---------- ---------- ---------- ----------
| Reapeated region |
| line 1 |
| line 2 |
!end repeated region |
|------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -|
If I use <table style="page-break-before: always;">
I get a blank page printed first
If I set the repeat region to -1 it gives me all records that OK
However when the file prints the second (or third etc) page the second page will start halfway through a repeated line.
It would be good to get at least a complete repeated area and preferably the top of each page (a heading printed.
Maybe the following sketch will illustrate the idea
--------------------------
| Heading information |
--------------------------
| Reapeated region |
| line 1 |
| line 2 |
!end repeated region |
|-------------------------
If I use <table style="page-break-before: always;">
I get a blank page printed first
If you want the site header to be printed on each page, you are going to have to set up a CSS file for printing.
However, if you are talking about printing the table headers, then you could try setting up a nested repeat to print the table headers every 20 records or so. Using this method will not print the headers at the top of each page, though.
However, if you are talking about printing the table headers, then you could try setting up a nested repeat to print the table headers every 20 records or so. Using this method will not print the headers at the top of each page, though.
>> Using this method will not print the headers at the top of each page, though.
I think it could if you used:
<tr style="page-break-after: always;">
or whatever DW uses to re-display the headers every 20 lines.
I think it could if you used:
<tr style="page-break-after: always;">
or whatever DW uses to re-display the headers every 20 lines.
ASKER
Thanks
Can you point me to any examples please?
Can you point me to any examples please?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks fuzzboxer:
I will come back to you on this.
I will come back to you on this.
ASKER
Thanks fuzzboxer:
That is great, one small item, at the moment it prints out a blank page as the first page. Can I prevent this?
That is great, one small item, at the moment it prints out a blank page as the first page. Can I prevent this?
Okay, I just tested it in IE6 and I see what you mean. It works fine in Firefox.
Here's a solution:
Put this code before the while loop:
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
</tr>
Now change the mod to 30 = 29.
That should get rid of the blank page and still print your header on the first page.
Put this code before the while loop:
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
</tr>
Now change the mod to 30 = 29.
That should get rid of the blank page and still print your header on the first page.
ASKER
Thanks so much.
I managed to get a simple page working fine but the more complicated page I need does not work.
I expect I am doing something wrong and wonwer if you can see the mistake?
I am getting an error
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/adbprod/BuildPreAssy2.asp , line 339
Code is:
I marked line 339
While ((Repeat1__numRows <> 0) AND (NOT rsPreAssy.EOF)) ' Line 339
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/ConnAldh aen.asp" -->
<%
Dim rsPreAssy
Dim rsPreAssy_numRows
Set rsPreAssy = Server.CreateObject("ADODB .Recordset ")
rsPreAssy.ActiveConnection = MM_ConnAldhaen_STRING
rsPreAssy.Source = "SELECT * FROM OperationsQ WHERE BoatTypeName ='military36' AND OpArea =2 ORDER BY OpBoatType ASC, OpArea ASC, OpSort ASC"
rsPreAssy.CursorType = 0
rsPreAssy.CursorLocation = 2
rsPreAssy.LockType = 1
rsPreAssy.Open()
rsPreAssy_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsPreAssy_numRows = rsPreAssy_numRows + Repeat1__numRows
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<script type="text/javascript" src="p7pm/p7popmenu.js"></ script>
<style type="text/css" media="screen">
<!--
@import url(p7pm/p7pmv12.css);
-->
</style>
<link href="Styles.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#000033" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="P7_initPM(0,12,1,- 20,10)">
<table>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsPreAssy.EOF)) ' Line 339
%>
<%
RecordCounter = RecordCounter + 1
If RecordCounter Mod 15 = 1 Then%>
<tr bgcolor="#FFFFFF" style="page-break-before: always;">
<th>Heading 1</th>
<th>Heading 2</th>
</tr>
<%End If%>
<tr bgcolor="#FFFFFF">
<td><%=(rsPreAssy.Fields.I tem("OpNam e").Value) %></td>
<td><%=(rsPreAssy.Fields.I tem("AreaN ame").Valu e)%></td>
</tr>
<%
Repeat1__index=Repeat1__in dex+1
Repeat1__numRows=Repeat1__ numRows-1
rsPreAssy.MoveNext()
Wend
%>
</table>
<p> </p>
</body>
</html>
<%
rsPreAssy.Close()
Set rsPreAssy = Nothing
%>
I managed to get a simple page working fine but the more complicated page I need does not work.
I expect I am doing something wrong and wonwer if you can see the mistake?
I am getting an error
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/adbprod/BuildPreAssy2.asp
Code is:
I marked line 339
While ((Repeat1__numRows <> 0) AND (NOT rsPreAssy.EOF)) ' Line 339
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/ConnAldh
<%
Dim rsPreAssy
Dim rsPreAssy_numRows
Set rsPreAssy = Server.CreateObject("ADODB
rsPreAssy.ActiveConnection
rsPreAssy.Source = "SELECT * FROM OperationsQ WHERE BoatTypeName ='military36' AND OpArea =2 ORDER BY OpBoatType ASC, OpArea ASC, OpSort ASC"
rsPreAssy.CursorType = 0
rsPreAssy.CursorLocation = 2
rsPreAssy.LockType = 1
rsPreAssy.Open()
rsPreAssy_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsPreAssy_numRows = rsPreAssy_numRows + Repeat1__numRows
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<script type="text/javascript" src="p7pm/p7popmenu.js"></
<style type="text/css" media="screen">
<!--
@import url(p7pm/p7pmv12.css);
-->
</style>
<link href="Styles.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#000033" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="P7_initPM(0,12,1,-
<table>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsPreAssy.EOF)) ' Line 339
%>
<%
RecordCounter = RecordCounter + 1
If RecordCounter Mod 15 = 1 Then%>
<tr bgcolor="#FFFFFF" style="page-break-before: always;">
<th>Heading 1</th>
<th>Heading 2</th>
</tr>
<%End If%>
<tr bgcolor="#FFFFFF">
<td><%=(rsPreAssy.Fields.I
<td><%=(rsPreAssy.Fields.I
</tr>
<%
Repeat1__index=Repeat1__in
Repeat1__numRows=Repeat1__
rsPreAssy.MoveNext()
Wend
%>
</table>
<p> </p>
</body>
</html>
<%
rsPreAssy.Close()
Set rsPreAssy = Nothing
%>
Were you getting this error before making any changes?
ASKER
Thanks
I think I found my mistake.
I hadnt changed recordset1 to rsPreAssy in some places.
I think I found my mistake.
I hadnt changed recordset1 to rsPreAssy in some places.
ASKER
Many thanks,
I have learned a great deal
John
I have learned a great deal
John
If so, you can do this in CSS. I presume the results appear in a table? If so, you can add this CSS style to wherever you need the page break to occur. This example uses a table
<table style="page-break-before: always;">
Post your code if you need more help here.