Word 无法触发事件
Word could not fire the event
我使用 Microsoft Office Interop Word 已经有一段时间了,没有任何问题,但现在突然停止工作了。
它现在给我异常消息
Word could not fire the event
我是 运行 Windows 10 Pro - 1809 的最新更新,我还安装了 office 2016 和最新更新。
我是 运行 Visual studio 2017
我使用下面的代码来测试这个问题:
using System;
using Word = Microsoft.Office.Interop.Word;
namespace WordTesting
{
class Program
{
static void Main(string[] args)
{
Word.Application application = new Word.Application();
application.Visible = false;
Word.Document document = null;
try
{
document = application.Documents.Open(@"C:\Users\caspe\Desktop\TEST.docx", Visible: false);
}
catch (Exception e)
{
application.Quit();
Console.WriteLine("Exception: {0}", e.Message);
}
Console.ReadKey();
}
}
}
这是我的参考资料:
上面的代码抛出一个:
Exception thrown: 'System.Runtime.InteropServices.COMException' in WordTesting.exe
而 Console.Writeline 是:
Exception: Word could not fire the event
完全异常:
System.Runtime.InteropServices.COMException: 'Word could not fire the event.'
UPDATE
I have just tested my build on another windows 10 machine with build 180 and there it works like a charm
我希望有人能找到解决问题的方法,因为我还没有找到。
好的,这是一个奇怪的解决方案。但是我在这里找到了 last post on this page and
所以基本上这是一个区域问题。我的地区是 ENG[DAN],因为丹麦。但是当我将所有内容都更改为 ENG[US] 时,它又起作用了。
我的实现中还有一些其他部分仍然无法正常工作,但现在这已经足够了。
我使用 Microsoft Office Interop Word 已经有一段时间了,没有任何问题,但现在突然停止工作了。 它现在给我异常消息
Word could not fire the event
我是 运行 Windows 10 Pro - 1809 的最新更新,我还安装了 office 2016 和最新更新。 我是 运行 Visual studio 2017
我使用下面的代码来测试这个问题:
using System;
using Word = Microsoft.Office.Interop.Word;
namespace WordTesting
{
class Program
{
static void Main(string[] args)
{
Word.Application application = new Word.Application();
application.Visible = false;
Word.Document document = null;
try
{
document = application.Documents.Open(@"C:\Users\caspe\Desktop\TEST.docx", Visible: false);
}
catch (Exception e)
{
application.Quit();
Console.WriteLine("Exception: {0}", e.Message);
}
Console.ReadKey();
}
}
}
这是我的参考资料:
上面的代码抛出一个:
Exception thrown: 'System.Runtime.InteropServices.COMException' in WordTesting.exe
而 Console.Writeline 是:
Exception: Word could not fire the event
完全异常:
System.Runtime.InteropServices.COMException: 'Word could not fire the event.'
UPDATE
I have just tested my build on another windows 10 machine with build 180 and there it works like a charm
我希望有人能找到解决问题的方法,因为我还没有找到。
好的,这是一个奇怪的解决方案。但是我在这里找到了 last post on this page and
所以基本上这是一个区域问题。我的地区是 ENG[DAN],因为丹麦。但是当我将所有内容都更改为 ENG[US] 时,它又起作用了。
我的实现中还有一些其他部分仍然无法正常工作,但现在这已经足够了。