且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Microsot办公室Interop

更新时间:2023-09-11 21:14:16

无法强制转换类型为Microsoft.Office.Interop.Word.ApplicationClass的com对象 [ ^ ]



http:// social。 msdn.microsoft.com/Forums/en/vsto/thread/ade5e2dc-42ee-4fe1-a1e6-bcb5eef01dfa [ ^ ]



HTTP ://回答s.microsoft.com/en-us/office/forum/office_2010-word/unable-to-cast-com-object-of-type/34efcd57-e819-4a83-9cdd-501ab15b0971 [ ^ ]
Unable to cast com object of type Microsoft.Office.Interop.Word.ApplicationClass[^]

http://social.msdn.microsoft.com/Forums/en/vsto/thread/ade5e2dc-42ee-4fe1-a1e6-bcb5eef01dfa[^]

http://answers.microsoft.com/en-us/office/forum/office_2010-word/unable-to-cast-com-object-of-type/34efcd57-e819-4a83-9cdd-501ab15b0971[^]


您可能没有安装Office。如果您只想使用某些Office文档,则可以使用Open XML SDK:

http://www.microsoft.com/en-us/download/details.aspx?id=30425 [ ^ ]。



这种方式,您可以支持新的基于XML的Office格式(例如.DOCX,.XLSX),ECMA-376标准:

http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats [ ^ ],

http://en.wikipedia.org/wiki/Office_Open_XML [ ^ ]。



这样,您可以在没有安装Office的情况下工作。此外,第三方软件支持这些文档。请查看我过去的答案:

将Office文档转换为PDF而不互操作 [ ^ ],>
需要一个相当独特的WPF文本编辑器控件 [ ^ ],

您好如何使用c#.net 在Windows应用程序中显示word文件[ ^ ],

阅读没有使用Interop.word dll的word文件...不想在IIS中安装单词。 [ ^ ]。



这是另一种选择: http://npoi.codeplex.com/ [ ^ ]。



-SA
You may not have Office installed. If you only want to work with some office documents, you can use Open XML SDK:
http://www.microsoft.com/en-us/download/details.aspx?id=30425[^].

This way, you can support new XML-based Office formats (such as .DOCX, .XLSX), ECMA-376 standard:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].

This way, you can work without Office installed. Also, the documents are supported by 3rd-party software. Please see my past answers:
Convert Office-Documents to PDF without interop[^],
Need a rather unique WPF text editor control[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

This is another option: http://npoi.codeplex.com/[^].

—SA