使用 MS Office Interop 遇到 .NET COMException
我正在尝试在 ASP.NET Web 应用程序中使用 Windows 剪贴板和 Office Interop。
在我运行 XP 的本地计算机上一切运行良好(我首先创建了一个 Windows 应用程序,它在本地计算机上运行得很好)。然后我在运行 Windows Server 2003 的服务器上执行它并且它也在那里工作。
然后我制作了一个 ASP.NET 示例项目,它可以在我的本地计算机上运行。然而,当我这次将它部署在服务器上时,在用权限敲打我的头后,它开始给我这个异常,我不知道它为什么这样做:
System.Runtime.InteropServices.COMException (0x80048240): Shapes (unknown member): Invalid request. Clipboard is empty or contains data which may not be pasted here. at Microsoft.Office.Interop.PowerPoint.Shapes.Paste()
剪贴板上是否再次出现任何类型的权限问题?如果是,我该如何授予适当的权限?
我需要复制准确的图表,我只是使用 MSDN 网站上的示例。
I am trying to work with the Windows clipboard and Office Interop in an ASP.NET web application.
Everything works well on my local machine running XP (i have created a Windows application first which ran perfectly well on local machine). Then I have executed it on a server running Windows Server 2003 and it worked there as well.
Then I made a ASP.NET sample project and it worked on my local machine. However when this time I deployed it at the server, after banging my head with permissions, it started giving me this exception which i have no idea why it is doing this:
System.Runtime.InteropServices.COMException (0x80048240): Shapes (unknown member): Invalid request. Clipboard is empty or contains data which may not be pasted here. at Microsoft.Office.Interop.PowerPoint.Shapes.Paste()
Is the problem with any sort of permissions again on clipboard? If yes, how can I grant appropriate permissions?
I need to copy the exact chart and I am just using example from MSDN website.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个长远的目标,但这篇文章是关于在 ASP.NET 中使用
Clipboard
类 表示您可能需要手动将活动线程的ApartmentState
更改为 < code>STA,以便能够在 ASP.NET 中使用剪贴板。Stackoverflow 上也有一些关于此主题的问题:
This is a long shot, but this article about using the
Clipboard
class in ASP.NET says that you might need to manually change theApartmentState
for the active thread toSTA
, to be able to use the clipboard in ASP.NET.There are a few questions about this subject on Stackoverflow as well: