精华网络内容 :http://www.qqread.com/network/
例子:
在"c:\excel\book1.xls"存在一个EXCEL表book1.xsl,表的结构如下:
1 序号 名称 金额
2 1 张三 100
3 2 李四 200
4 3 王五 300
序号字段不为空
注意:excel 起始行是1而不是为0
<%@language=vbscript %>
<%
Set xlApp = server.CreateObject("Excel.Application")
strsource = "c:\excel\book1.xls"
Set xlbook = xlApp.Workbooks.Open(strsource)
Set xlsheet = xlbook.Worksheets(1)
i=1
response.write "<table cellpadding=0 cellspacing=0 border=1 width=500>"
while xlsheet.cells(i,1)<>""
response.write "<tr>"
response.write " <td height=20 align=center width=100>" & xlsheet.Cells(i, 1) & "</td>"
response.write " <td height=20 align=center width=200>" & xlsheet.Cells(i, 2) & "</td>"
response.write " <td height=20 align=center width=200>" & 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"是不行的。
%>进入讨论组讨论。
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- asp检测文件编码 (0次浏览)
- ASP发送邮件的class(完) (0次浏览)
- Asp常见问题(新手) (0次浏览)
- asp编译成dll-图形化教程 (0次浏览)
- ASP编程入门进阶 (0次浏览)
- Asp备份与恢复SQL Server数据库 (0次浏览)
- Asp+的几个特点 (0次浏览)
- ASP:在结果中搜索 (0次浏览)
- asp 中对 ip 进行过滤限制函数 (0次浏览)
- ASP 指南 (0次浏览)



