Wrox Programmer Forums
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 2nd, 2004, 06:32 AM
Friend of Wrox
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default Printer settings


  I am generating HTML report. Payslip of employees.
while not rs.eof
strTable=strTable & "<tr><td>" & rs(0) & "</td><td>" & rs(1) & "</td></tr>"
strTable=strTable & "</table>"

The table may be around 22 lines. I want to print 3 payslips on each page. How can i restrict page margins, paper type, page break etc.

Pls, suggest me.

Thanx in advance

The Following User Says Thank You to rajanikrishna For This Useful Post:
Old June 6th, 2004, 11:08 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts

page break you can do by paging.
try this.

CONN_STRING = "DBQ=" & Server.MapPath("database.mdb") & ";"
CONN_STRING = CONN_STRING & "Driver={Microsoft Access Driver (*.mdb)};"


CONN_STRING = "Provider=SQLOLEDB;Data Source=;" _
    & "Initial Catalog=Admin;Connect Timeout=15;" _
    & "Network Library=dbmssocn;"
CONN_PASS = "password"

Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strOrderBy
Dim strSQL
Dim objPagingConn
Dim objPagingRS
Dim iRecordsShown
Dim I

iPageSize = 1 ' You could easily allow users to change this

If Request.QueryString("page") = "" Then
    iPageCurrent = 1
    iPageCurrent = CInt(Request.QueryString("page"))
End If

strOrderBy = LCase(Request.QueryString("order"))

strSQL = "select distinct contractno from approvals"

Set objPagingConn = Server.CreateObject("ADODB.Connection")
objPagingConn.Open "" // connection string

Set objPagingRS = Server.CreateObject("ADODB.Recordset")
objPagingRS.PageSize = iPageSize

objPagingRS.CacheSize = iPageSize

objPagingRS.Open strSQL, objPagingConn, adOpenStatic, adLockReadOnly, adCmdText

iPageCount = objPagingRS.PageCount

If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1

If iPageCount = 0 Then
    Response.Write "No records found!"
    ' Move to the selected page
    objPagingRS.AbsolutePage = iPageCurrent

    ' Start output with a page x of n line

    ' Spacing
    Response.Write vbCrLf

iRecordsShown = 0
    Do While iRecordsShown < iPageSize And Not objPagingRS.EOF
        Response.Write vbTab & "<tr bgcolor=>" & vbCrLf
        For I = 0 To objPagingRS.Fields.Count - 1
            Response.Write vbTab & vbTab & "<td>"
             Response.Write objPagingRS.Fields(I)
            Response.Write "</td>" & vbCrLf
        Next 'I
        Response.Write vbTab & "</tr>" & vbCrLf

        ' Increment the number of records we've shown
        iRecordsShown = iRecordsShown + 1
        ' Can't forget to move to the next record!

    Response.Write "</table>" & vbCrLf
End If


Set objPagingRS = Nothing
Set objPagingConn = Nothing

If iPageCurrent > 1 Then

    <a href="paging.asp?page=<%= I %>&order=<%= Server.URLEncode(strOrderBy) %>"><%= I %></a>
    End If
Next 'I

If iPageCurrent < iPageCount Then
    <a href="paging.asp?page=<%= iPageCurrent + 1 %>&order=<%= Server.URLEncode(strOrderBy) %>">[Next &gt;&gt;]</a>
Old June 7th, 2004, 09:00 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

Hi Mateen,

I think RajaniKrishna is not asking for PAGING in display of records. He is referring to setting the PAGE MARGIN, PAGE BREAK, PAGE LENGTH etc... for the PAGE to be printed.

I am not sure about setting them off, Let me explore and update you if I find anything usefull.


-Vijay G
Strive for Perfection
The Following User Says Thank You to happygv For This Useful Post:
Old June 7th, 2004, 11:46 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

Hi RajaniKrisna,

The only thing that could help you out on this, could be the CSS.

I could find nothing else that could help you.

CSS and Printing - deals with page breaks.

CSS2 Print Reference

You can try this.

-Vijay G
Strive for Perfection
Old July 4th, 2004, 01:58 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega

Or you can read this: http://www.asp101.com/articles/john/...nt/default.asp

 - mega

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printer settings rajanikrishna Classic ASP Professional 8 April 7th, 2006 03:48 AM
printer settings at client side ramesh.b ASP.NET 2.0 Professional 0 March 7th, 2006 09:00 AM
Programmatically Change Printer Settings vempativenu Beginning VB 6 0 September 2nd, 2004 06:29 AM
Printer Settings melvik C# 0 May 25th, 2004 02:11 AM
how to save & restore default printer settings? Tiffany Pro VB 6 1 April 7th, 2004 06:59 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.