“80040154 类未注册”与 C# 中的 Word 互操作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10845841/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
“80040154 Class not registered” with Word interop from C#
提问by user1430035
I have an urgent request from client to enable loading of the word files(.doc).
我有一个来自客户的紧急请求,要求启用 Word 文件 (.doc) 的加载。
the current functionality uses, OpenXml which allows only .docx files, and throws an exception if we try to upload/read .doc files.
当前功能使用 OpenXml,它只允许 .docx 文件,并在我们尝试上传/读取 .doc 文件时抛出异常。
so, i tried using Microsoft.Office.Interop.Wordto read the data in file and for page count.
所以,我尝试使用Microsoft.Office.Interop.Word来读取文件中的数据和页数。
It all works in my local environment.(i am working using VS2008). but when i deployed in my development machine, i am getting an error “80040154 Class not registered”.
这一切都适用于我的本地环境。(我正在使用 VS2008)。但是当我部署在我的开发机器上时,我收到错误“80040154 类未注册”。
guys, i have already searched on this, but i am not sure what to do ... some says its because the development machine is 64bit.. if so, how to configure it to accept 32bit dll?
伙计们,我已经搜索过这个,但我不知道该怎么做……有人说这是因为开发机器是 64 位的……如果是这样,如何配置它以接受 32 位 dll?
can any one just atleast guide me how to resolve this error, or is there any other ways reading word .doc file?
任何人都可以至少指导我如何解决此错误,还是有其他方法可以读取 word .doc 文件?
if you need any other information, please ask
如果您需要任何其他信息,请询问
回答by Alexandru C.
The COM object you are trying to access is not installed correctly on your deployment machine. The CLSID of the object needs to be in the registry.
您尝试访问的 COM 对象未正确安装在您的部署计算机上。对象的 CLSID 需要在注册表中。
You can check if you have the interop assembliesfor MS Word installed.
You can check this questionsalso.
您也可以检查这些问题。

