从Web窗体应用程序保存Excel电子表格 [英] Save Excel spreadsheet from web forms app

查看:98
本文介绍了从Web窗体应用程序保存Excel电子表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Excel生成电子表格的Web表单应用程序.我需要通过调用SaveAs例程来保存该电子表格.我在XP下运行的代码没有任何问题.在Vista下运行,我无法保存电子表格.我最初试图将其保存到c:\ Program Files \ MyApp \中创建的App_Data目录.显然,无论我做什么,Vista都不允许我在程序文件"下的任何位置保存文件.我已经尝试过对MyDocuments和Internetcache使用SpecialFolder选项-这些也不能在Vista下工作.我还尝试将文件保存到c:\ Windows \ Temp目录,但再次失败.

有人可以告诉我我需要做什么才能以在XP和Vista下都可以工作的方式保存电子表格. ?

I have a web forms application that uses Excel to generate a spreadsheet.  I need to save that spreadsheet by calling the SaveAs routine.  I have no problems with the code running under XP.  Running under Vista I cannot save the spreadsheet.  I was originally trying to save it to the App_Data directory that is created in c:\Program Files\MyApp\.  Apparently no matter what I do Vista will not allow me to save a file anywhere under Program Files.  I've tried using the SpecialFolder options for MyDocuments and Internetcache - those don't work under Vista either.  I also tried to save to the c:\Windows\Temp directory, again without success.

Can somebody tell me what I need to do in order to save a spreadsheet in a manner that works under both XP and Vista?

推荐答案

您确定这是Web窗体应用程序吗?
如果是这样-也许托管ASP.Net页的进程无权访问这些目录

据我所知,您可以更改模拟"和认证" web.config文件中的设置.
但是我对ASP.Net的世界并不了解.

最好在ASP.Net论坛中提问.

但是-它是不建议使用Web应用程序或服务中的Office应用程序.
更好地尝试简单地编写实现OpenDocument Standard的XML文件.

Are you sure this is a Web Forms application ?
If so - maybe the process hosting the ASP.Net page has no rights to access those directories.

As I know you can change the "Impersonation" and "Authentication" Settings in the web.config file.
But I'm not too deep in the ASP.Net world.

Better Ask in an ASP.Net Forum.

However - it is not recommended to use an Office Application from a Web Application or Service.
Better try to simply write an XML-File that implements the OpenDocument Standard.

http://msdn.microsoft.com/en-us/office/aa905545.aspx

Hope this helps,
greets - Helmut


这篇关于从Web窗体应用程序保存Excel电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆