INTERFACE NOT REGISTERED在服务器中读取word文件时出错 [英] INTERFACE NOT REGISTERED Error while Reading word file in server

查看:77
本文介绍了INTERFACE NOT REGISTERED在服务器中读取word文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从服务器读取word文件时出现错误INTERFACE NOT REGISTERED(HRESULT异常:0x80040155),它在我的本地系统上工作正常.....请帮助









I have the error INTERFACE NOT REGISTERED (Exception From HRESULT:0x80040155) while reading word file from server and it works fine on my local system.....please help




object missingType = Type.Missing;
                   object readOnly = true;
                   object isVisible = false;
                   object documentFormat = 8;
                   object htmlFilePath = Server.MapPath("~/Uploads/Resume/Temp/") + Resume + ".htm";
                   string directoryPath = Server.MapPath("~/Uploads/Resume/Temp/") + Resume + "_files";

                   object fileName = Server.MapPath("~/Uploads/Resume/" + Resume);//FileUpload1.PostedFile.FileName;

                   //Open the word document in background
                   ApplicationClass applicationclass = new ApplicationClass();
                   applicationclass.Documents.Open(ref fileName,
                                                   ref readOnly,ref missingType, ref missingType, ref missingType,ref missingType, ref missingType, ref  missingType,ref missingType, ref missingType, ref isVisible,ref missingType, ref missingType, ref missingType,ref missingType, ref missingType);
                   applicationclass.Visible = false;
                   Document document = applicationclass.ActiveDocument;



                   //Save the word document as HTML file
                   document.SaveAs(ref htmlFilePath, ref documentFormat, ref missingType,
                                   ref missingType, ref missingType, ref missingType,
                                   ref missingType, ref missingType, ref missingType,
                                   ref missingType, ref missingType, ref missingType,
                                   ref missingType, ref missingType, ref missingType,
                                   ref missingType);


                   //Close the word document
                   document.Close(ref missingType, ref missingType, ref missingType);

                   iframe.Attributes.Add("src", "../Uploads/Resume/Temp/" + Resume + ".htm");

推荐答案

这么简单:服务器上没有安装Word(或者只安装了旧版本的Word)。

而且,不,在服务器上使用Word(或其他MS Office产品)不是一个好主意。寻找替代库来处理MS Office文件。
Such a simple thing: Word is not installed on the server (or only an older version of it).
And, no, it is not a good idea to use Word (or other MS Office products) on a server. Look for alternative libraries for dealing with MS Office files.


这篇关于INTERFACE NOT REGISTERED在服务器中读取word文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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