小编use*_*449的帖子

如何解决错误:因以下错误而失败:80040154 类未注册

如何解决以下错误。运行时出现此错误。

由于以下错误,检索具有 CLSID {000209FF-0000-0000-C000-000000000046} 的组件的 COM 类工厂失败:80040154 类未注册(HRESULT 异常:0x80040154 (REGDB_REGT)CLASSNO)。

代码:此代码用于将 word 转换为 pdf 文档文件。我在这一行出错。

Application wordApp = new Microsoft.Office.Interop.Word.Application();
Document wordDocument = new Document();           
private void ConvertWord2PDF(string inputFile, string outputPath)
{

        try
        {
            if (outputPath.Equals("") || !File.Exists(inputFile))
            {
                throw new Exception("Either file does not exist or invalid output path");
            }

            // app to open the document belower
            Application wordApp = new Microsoft.Office.Interop.Word.Application();
            Document wordDocument = new Document();

            // input variables
            object objInputFile = inputFile;
            object missParam = Type.Missing;

            wordDocument …
Run Code Online (Sandbox Code Playgroud)

c# asp.net com ms-word exception

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

asp.net ×1

c# ×1

com ×1

exception ×1

ms-word ×1