ASP环境下轻松实现报表的打印 (转)

ASP环境下轻松实现报表的打印 (转)[@more@]

 

一、前言
  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
 
  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
  %>
 
  <object id=reportatl classid="clsid:D3F064E5-F4C0-4C52-9E7F-263D96B7EA11" codebase="Report.cab#version=1,0,0,1">
 
 
   
 
用Visual Report Design 产生的报表脚本mxb.rsp:

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

 

dim rs,con,sql,lsh
 dim temp
 set con =CreateObject("ADOdb.Connection")
 con.ConnectionString = "DBQ=c:reportdemoaspreport.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.Write cstr(rs("xm"))

 Report.Write cstr(rs("yw"))

 Report.Write cstr(rs("sx"))

 Report.Write cstr(rs("yy"))

 Report.Write cstr((rs("yw")+rs("sx")+rs("yy"))/3)

 Report.Write cstr(rs("yw")+rs("sx")+rs("yy"))

 report.write "打印日期:"+formatdatetime(date(),1)

共%Pages%页,第%Page%页

do while not rs.eof
 page_body()
 rs.movenext
 loop
 rs.close
 set rs=nothing
 con.close
 set con=nothing

 

四、其它信息
  这是本人第一个开发工具,做得不好请指教
  详细情况可以看:http://go.163.com/reportpro/
  关于在ASP下使用的详细例子可以看c:demoasp/目录


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-990431/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752043/viewspace-990431/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值