c# winform 读取word内容时报错

  1. 隔离 COM 引用“Microsoft.Office.Interop.Word”时出现问题: 未导入注册表项“HKEY_CLASSES_ROOT\CLSID{00020906-0000-0000-c000-000000000046}\AuxUserType”。 ProjectManager

    doc.Close(ref nullobj, ref nullobj, ref nullobj);
    引起下面提示:

  2. 方法“Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)”和非方法“Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close”之间存在二义性。将使用方法组。 N:\360Downloads\ProjectManager\ProjectManager\ProjectManager\ViewXInforMation.cs 165 17 ProjectManager

谢谢大家

以管理员权限运行VS,重新引用下Office.Interop.Word。

参考 Word Document Close之间存在二义性解决方案

解决方案:
Word._Document doc = null;

上面的答案有帮助吗?如果还有问题,请提出来,如果对答案满意,请顶一下,并标记为采纳答案,谢谢!