xml| Print One, preface
ASP is widely used in e-commerce, and there are some problems in report processing. This article describes the use of ASP
I write the report Server page script interpreter to achieve the display of reports, printing.
Ii. preparatory work
(1) Install visual Reprort design software
Visual reports design is a free Report Designer I write, the release of the program only needs
You can install a control.
Want the Netizen can go to http://go.163.com/reportpro/to download
(2) Design report
You can generate a script for a report through the visual interface of visual reports: MXB.RSP.
Third, the realization of the report of the printing, display
The following is the document that was invoked:
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 using visual MXB.RSP:
<?xml version= ' 1.0 ' encoding= ' GB2312 '?>
<! DOCTYPE ' Print_report.dtd ' >
<report name= ' report ' >
<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= ', ' Arial ' font_size= ', '--', ' and font_weight= ' italic= ' 0 ' font_underline= ' 0 ' >
Schedule of Achievements
</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= ' song Body ' 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= ' a ' 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= ' song Body ' font_size= ' 9 ' font_weight= ' ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >
English
</text>
<text name= ' vfptext ' top= ' 2 ' left= ' 162 ', width= ' 6 ' height= ' 3 ' font_name= ' Arial ' font_size= ' 9 ' font_weight= ' ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >
Total
</text>
<text name= ' vfptext ' top= ' 2 ' left= ' 130 ', width= ' 6 ' height= ' 3 ' font_name= ' Arial ' font_size= ' 9 ' font_weight= ' ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >
Average
</text>
</page_head>
<page_body height= ' 8 ' >
<text name= ' vfptext ' top= ' 2 ' left= ' ' width= ' 4 ' height= '--'--' font_name= '--'--' 9 ' font_size= ' font_weight= ' italic= ' 0 ' font_underline= ' 0 ' >
<report_script>
Report.write CStr (RS ("XM"))
</report_script>
</text>
<text name= ' vfptext ' top= ' 2 ' left= ' ' width= ' height= ' 4 ' font_name= ' song Body ' font_size= ' 9 ' font_weight= ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >
<report_script>
Report.write CStr (rs ("yw"))
</report_script>
</text>
<text name= ' vfptext ' top= ' 2 ' left= ' ' width= ' height= ' 4 ' font_name= ' song ' font_size= ' 9 ' font_weight= ' ' Font_ ' italic= ' 0 ' font_underline= ' 0 ' >
<report_script>
Report.write CStr (RS ("SX")