zoukankan      html  css  js  c++  java
  • ASP环境下轻松实现报表的打印 (转)


    作者:zcg2000
    一、前言
    ASP在电子商务上应用广泛,报表的处理又有一些麻烦。本文介绍了在ASP中利用
    本人写的Report Server Page脚本解释器实现报表的显示、打印。
    二、准备工作
    (1)安装Visual Reprort Design软件
    Visual Report Design是本人写的一个免费的报表设计器,程序的发行仅仅须要
    安装一个60K的控件就可以。


    想要的网友能够到http://go.163.com/reportpro/下载
    (2)设计报表
    通过Visual Report Design 的可视化界面能够生成报表的脚本:mxb.rsp。
    三、实现报表的打印、显示
    以下是调用的文档:
    printmx.asp
    <%Option Explicit%>
    <%
    dim ReportName,ret
    dim ReportAtl
    dim name
    set ReportAtl=Session("ReportAtl")
    ReportName=Server.MapPath("mxb.rsp")
    ret=reportatl.XMLToVBS(ReportName)
    if ret=-1 then
    response.write reportatl.ErrorMsg
    response.end
    end if

    ReportName=Server.MapPath("mxb.vbs")
    ret=reportatl.DoScript(ReportName)
    if ret=-1 then
    response.write reportatl.ErrorMsg
    set ReportAtl=nothing
    response.end
    end if
    set ReportAtl=nothing
    %>
    <html>
    <OBJECT id=reportatl classid="clsid:D3F064E5-F4C0-4C52-9E7F-263D96B7EA11" codebase="Report.cab#version=1,0,0,1">
    </OBJECT>
    <script language=vbscript>
    dim ret
    ret=reportatl.DoPrintReport("mxb.zcg")
    if ret=-1 then
    msgbox reportatl.ErrorMsg
    end if
    </script>
    </html> 

    用Visual Report Design 产生的报表脚本mxb.rsp:

    <?xml version='1.0' encoding='GB2312' ?>

    <!DOCTYPE report SYSTEM 'print_report.dtd' >

    <report name='报表'>

    <report_script>

    dim rs,con,sql,lsh
    dim temp
    set con =CreateObject("ADODB.Connection")
    con.ConnectionString = "DBQ=c: eportdemoasp eport.mdb;DRIVER={Microsoft Access Driver (*.mdb)};"
    con.open
    Set rs =CreateObject("ADODB.Recordset")
    sql="SELECT * FROM cj,student where cj.id=student.id "
    rs.open sql,con,1,3

    </report_script>

    <report_head height='12'>

    <text name='vfptext' top='4' left='76' width='26' height='5' font_name='宋体' font_size='14' font_weight='700' font_italic='0' font_underline='0' >

    成绩明细表

    </text>

    </report_head>

    <page_head height='6'>

    <line name='vfpline' top='0' left='9' width='178' height='0' weight='131072'>

    </line>

    <line name='vfpline' top='6' left='9' width='178' height='0' weight='131072'>

    </line>

    <text name='vfptext' top='2' left='18' width='6' height='3' font_name='宋体' font_size='9' font_weight='700' font_italic='0' font_underline='0' >

    姓名

    </text>

    <text name='vfptext' top='2' left='46' width='6' height='3' font_name='宋体' font_size='9' font_weight='700' font_italic='0' font_underline='0' >

    语文

    </text>

    <text name='vfptext' top='2' left='72' width='6' height='3' font_name='宋体' font_size='9' font_weight='700' font_italic='0' font_underline='0' >

    数学

    </text>

    <text name='vfptext' top='2' left='99' width='6' height='3' font_name='宋体' font_size='9' font_weight='700' font_italic='0' font_underline='0'> 

  • 相关阅读:
    CSS效果:CSS实用技巧制作三角形以及箭头效果
    JS之this应用详解
    JS之iscroll.js的使用详解
    一个测试人员眼中的创业团队七宗罪
    一个WEB应用的开发流程
    一个年薪一百万的程序员:技术进阶之路
    一个十年IT从业者的职场感言:为什么不要自称是“程序员”
    一位程序员工作10年总结的13个忠告,却让很多人惋惜
    当个好的测试经理不容易,懂得这些很重要
    测试经理岗位职责及应具备的能力
  • 原文地址:https://www.cnblogs.com/lxjshuju/p/7102754.html
Copyright © 2011-2022 走看看