1个回答
2014-02-28
展开全部
<%
set xlApp = server.CreateObject("Excel.Application")
strsource = server.MapPath("xl.xls")
set xlbook = xlApp.WorkBooks.Open(strsource)
set xlsheet = xlbook.Worksheets(1)
i = 1
response.write "<table>"
while xlsheet.cells(i,1) <> ""
response.write "<tr>"
response.write "<td>" & xlsheet.Cells(i,1) & "</td>"
response.write "<td>" & xlsheet.Cells(i,2) & "</td>"
response.write "<td>" & xlsheet.Cells(i,3) & "</td>"
response.write "<tr>"
i = i + 1
wend
response.write "</table>"
set xlsheet = nothing
set xlbook = nothing
xlApp.quit
'千万记住要加这一句,否则每运行一次你的机器里就增加一个Excel进程,而且无法释放
'set xlApp = nothing 是不行的
%>
set xlApp = server.CreateObject("Excel.Application")
strsource = server.MapPath("xl.xls")
set xlbook = xlApp.WorkBooks.Open(strsource)
set xlsheet = xlbook.Worksheets(1)
i = 1
response.write "<table>"
while xlsheet.cells(i,1) <> ""
response.write "<tr>"
response.write "<td>" & xlsheet.Cells(i,1) & "</td>"
response.write "<td>" & xlsheet.Cells(i,2) & "</td>"
response.write "<td>" & xlsheet.Cells(i,3) & "</td>"
response.write "<tr>"
i = i + 1
wend
response.write "</table>"
set xlsheet = nothing
set xlbook = nothing
xlApp.quit
'千万记住要加这一句,否则每运行一次你的机器里就增加一个Excel进程,而且无法释放
'set xlApp = nothing 是不行的
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询