| <HTML>
<Head>
<Meta content = "text/html; charset = gb2312" http-equiv = Content-Type>
<Title> client workbook printing </title>
</Head>
<Body bgcolor = skyblue topmargin = 5 leftmargin = "20" oncontextmenu = "Return false" rightmargin = 0 bottommargin = "0">
<Div align = "center"> <center>
<Table border = "1" bgcolor = "# ffe4b5" style = "height: 1px; top: 0px" bordercolor = "# 0000ff">
<Tr>
<TD align = "Middle" bgcolor = "# ffffff" bordercolor = "#000080">
<Font color = "#000080" size = "3">
Client workbook Printing
</Font>
</TD>
</Tr>
</Table>
</Div>
<Form name = "myform">
<Div align = left>
<Input type = "button" value = "Excel report" name = "report" Language = "VBScript" onclick = "fun_excel ()" style = "height: 32px; width: 90px ">
</Div>
</Form>
</Body>
</Html>
<Script language = "VBScript">
Sub fun_excel ()
Dim RDS, RS, DF
Dim strcn, strsql, strrs
Dim xlapp, xlbook, xlsheet1
Set RDS = Createobject ("RDS. DataSpace ")
Set df = RDS. Createobject ("rdsserver. DataFactory", "http: // 192.168.0.1") '192. 168.0.1 is the IP address of the web server
Strcn = "provider = MS remote; Remote Server = http: // 192.168.0.1; handler = msdfmap. Handler; Data Source = pubsdatabase;" '192. 168.0.1 is the Web Server IP Address
Strsql = "getalljobs"
Set rs = DF. Query (strcn, strsql)
Set xlapp = Createobject ("Excel. application") 'Note: Server. Createobject ("Excel. application ")
Set xlbook = xlapp. workbooks. Add
Set xlsheet1 = xlbook. worksheets (1)
Xlsheet1.cells (1, 1). value = "job table"
Xlsheet1.range ("A1: d1"). Merge
Xlsheet1.cells (2, 1). value = "job_id"
Xlsheet1.cells (2, 2). value = "job_desc"
Xlsheet1.cells (2, 3). value = "max_lvl"
Xlsheet1.cells (2, 4). value = "min_lvl"
CNT = 3
Do while not Rs. EOF
Xlsheet1.cells (CNT, 1). value = RS ("job_id ")
Xlsheet1.cells (CNT, 2). value = RS ("job_desc ")
Xlsheet1.cells (CNT, 3). value = RS ("max_lvl ")
Xlsheet1.cells (CNT, 4). value = RS ("min_lvl ")
Rs. movenext
CNT = CINT (CNT) + 1
Loop
Xlsheet1.application. Visible = true
End sub
</SCRIPT> |