如何解决以下错误。运行时出现此错误。
由于以下错误,检索具有 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)