There is an Excel table book1.xsl in "c: /excel/book1.xls", the structure of the table is as follows:
1 serial number name amount
2 1 three 100
3 2 Li Si 200
4 3 Wang 500 P>
The serial number field is not empty
Note: Excel starting line is 1 instead of 0 p>
<% @ language = vbscript%>
<% P>
set xlapp = server.createObject ("excel.application") p>
strsource = "c: /excel/book1.xls" p>
set xlbook = xlapp.workbooks.open (strsource)
Set xlsheet = xlbook.worksheets (1) p>
i = 1
Response.write "
"
While Xlsheet.cells (i, 1) <> "" p>
response.write "
"
Response.write "
" & xlsheet.cells (i, 1) & " td>"
Response.write " | " & xlsheet.cells (i, 2) & " td>"
Response.write " | " & xlsheet.cells (i, 3) & " td>"
Response.write " TR>"
i = i 1 p> Wend
Response.write " TABLE>"
Set Xlsheet = Nothing
Set XLBook = Nothing
XLapp.quit 'Remember to add this sentence, otherwise an Excel process is added every time your machine is running, and it cannot be released.
转载请注明原文地址:https://www.9cbs.com/read-20833.html
|