Author: zcg2000
First, preface
ASP is widely used in e-commerce, and the processing of reports has some trouble. This article describes the use of the
I wrote the report Server page script interpreter to implement the display and printing of reports.
Ii. Preparatory work
(1) Installing visual Reprort design software
Visual reports design is a free Report Designer I wrote, the release of the program only needs
install a 60K control.
want to the Netizen can go to http://go.163.com/reportpro/download
(2) Design report
scripts for reports can be generated through visual report Design's visual interface: MXB.RSP.
third, the realization of the report printing, display
The following is the document that is called:
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
%>
<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>
Report script generated with visual reports Design MXB.RSP:
<?xml version= ' 1.0 ' encoding= ' GB2312 '?>
<! DOCTYPE report SYSTEM ' PRINT_REPORT.DTD ' >
<report name= ' reports ' >
<report_script>
Dim rs,con,sql,lsh
Dim temp
Set con =createobject ("ADODB. Connection ")
Con. ConnectionString = "Dbq=c:\report\demo\asp\report.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= ' >
<text name= ' vfptext ' top= ' 4 ' left= ' ' width= ' height= ' 5 ' font_name= ' song Body ' font_size= ' font_weight= ' italic= ' 0 ' font_underline= ' 0 ' >
Score Schedule
</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= ' width= ' 6 ' height= ' 3 ' font_name= ' Arial ' font_size= ' 9 ' font_weight= ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >
Name
</text>
<text name= ' vfptext ' top= ' 2 ' left= ' ' width= ' 6 ' height= ' 3 ' font_name= ' Arial ' font_size= ' 9 ' font_weight= ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >
Chinese
</text>
<text name= ' vfptext ' top= ' 2 ' left= ' ' width= ' 6 ' height= ' 3 ' font_name= ' Arial ' font_size= ' 9 ' font_weight= ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >
Mathematical
</text>
<text name= ' vfptext ' top= ' 2 ' left= ' ' width= ' 6 ' height= ' 3 ' font_name= ' Arial ' font_size= ' 9 ' font_weight= ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >