[英]How to create real excel file in Classic ASP
I have been exporting excel files using application/vnd.ms-excel
option in classic ASP but after downloading when I click Save As
I see Save As Type
option = web page . 我一直在使用经典ASP中的
application/vnd.ms-excel
选项导出excel文件,但是在下载后单击“ Save As
,看到“ Save As Type
选项= web page 。
So is there any way to Save As
by default so the file type can be saved as an " Excel 97-2003 WorkBook "? 那么默认情况下是否有任何方法可以
Save As
,因此文件类型可以另存为“ Excel 97-2003 WorkBook ”? I tried excel.application
and owc
but unfortunately neither work for me. 我试图
excel.application
和owc
但遗憾的是没有为我工作。
Actually, these options are consuming a lot of CPU memory when I use them. 实际上,当我使用这些选项时,它们会消耗大量的CPU内存。
I am open to using any third party component for excel creation. 我愿意使用任何第三方组件进行excel创建。
Thanks. 谢谢。
I am not sure if you are aware but you can access the Excel DOM using classic ASP as long as you have Excel installed on the web server. 我不确定是否知道,但是只要在Web服务器上安装了Excel,就可以使用经典ASP访问Excel DOM。
There are limitations to what you can do but if your requirements are simple then it might be the answer you are looking for without the need to purchase expensive components which are starting to become unsupported. 您可以做的事情有局限性,但是如果您的要求很简单,那么可能正是您所需要的答案,而无需购买昂贵的组件,这些组件开始变得不受支持。
Set oExcel = Server.CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.ActiveSheet
Set oRange = oExcel.ActiveCell
oRange.Cells(1,1) = "First Column"
oRange.Cells(1,2) = "Second Column"
oBook.SaveAs "workbook.xls"
oBook.Close
oExcel.Quit
Set oExcel = Nothing
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.