关于将ASP页面数据导入EXCEL

wangweisilu 2009-08-29 08:45:30
不知道那位大哥有实现代码,发份给我邮箱:267005253@qq.com,发的留个言能用的给分,谢谢了
...全文
80 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
poiuy343 2009-08-30
  • 打赏
  • 举报
回复
权限问题 参考
http://www.baidu.com/s?wd=Server.CreateObject+%B5%C4%B5%F7%D3%C3%CA%A7%B0%DC
http://hi.baidu.com/lijunliang/blog/item/adafcfbf9551bc0218d81fb4.html

我也是百度搜索出来 你可以google一下
poiuy343 2009-08-29
  • 打赏
  • 举报
回复

strAddr = Server.MapPath(".")
set objExcelApp = server.CreateObject("Excel.Application")
objExcelApp.DisplayAlerts = false
objExcelApp.Application.Visible = false
objExcelApp.WorkBooks.add
set objExcelBook = objExcelApp.ActiveWorkBook
set objExcelSheets = objExcelBook.Worksheets
set sheetActive=objExcelApp.ActiveWorkbook.ActiveSheet '实例化 sheetActive.range(strRange).value=array("ss","mm","ss")
set objExcelSheet = objExcelBook.Sheets(1)

strRange="a"&i+1&":f"&i+1 '设定要填写内容的单元区域
sheetActive.range(strRange).font.size=10 '设定字体大小
sheetActive.range(strRange).WrapText=false '设定文字回卷
sheetActive.range(strRange).ShrinkToFit=true '设定是否自动适应表格单元大小
sheetActive.range(strRange).value=array(rs1("A"),rs1("B"),rs1("C"),rs1("D"),rs1("E"),rs1("F")) '把数据集中的数据填写到相应的单元中

'############################################### 产生时间名为名称的excel文件
p=replace (now(),":","" )
p=replace(p,"-","")
p=replace(p," ","")
response.Write p&".xls 生成成功"



objExcelBook.SaveAs strAddr & "\xls\"&p&".xls"

objExcelApp.Quit
set objExcelApp = Nothing
response.Write "<center><span class=STYLE1>导出成功<br>"
response.Write "点击<a href='xls\"&p&".xls' target='_blank'>打开</a>导出的Excel文件</span></center>"





具体操作详见http://hi.baidu.com/xymc_001/blog/item/295483c2c3a39b1a0ff4771b.html
ASP操作excel总结
lzp4881 2009-08-29
  • 打赏
  • 举报
回复
<%
if request.querystring("action")="toExcel" then
Response.ContentType="application/vnd.ms-excel"
Response.AddHeader "content-disposition","attachment;filename=aaa.xls"
end if
if request.querystring("action")="toWord" then
Response.ContentType="application/msword"
Response.AddHeader "content-disposition","attachment;filename=aaa.doc"
end if
%>

<html>
<body>
<table name="data" id="data" width="100%" height="25%" border="0" cellpadding="1" cellspacing="1">
<tr>
<td width="50%" align="center" bgcolor="#FFFFCC"> <strong>职务 </strong> </td>
<td width="50%" align="center" bgcolor="#FFFFCC"> <strong>职级 </strong> </td>
</tr>
</table>
<input type="button" name="out_excel" onClick="location.href='?action=toExcel'" value="导出到excel">
<input type="button" name="out_word" onClick="location.href='?action=toWord'" value="导出到word">

</body>
</html>
wangweisilu 2009-08-29
  • 打赏
  • 举报
回复
检查权限时,对 Server.CreateObject 的调用失败。拒绝对此对象的访问。
这个怎么结局啊,LS的有详细的联系方式吗,想跟你学习下
wangweisilu 2009-08-29
  • 打赏
  • 举报
回复
我先试试楼上的代码,谢谢

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧