重新打开MS Project文件 [英] Reopen MS Project file

查看:96
本文介绍了重新打开MS Project文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码打开ms项目文件。文件的关闭是手动完成的,但我想处理事件以便能够清理清理所需的资源。使用此代码,我第一次尝试打开文件时没有问题。



手动关闭文件并尝试调用OpenReport时遇到问题(重新打开文件)。我收到错误:



无法将Microsoft.Office.Interop.MSProject.ApplicationClass类型的COM对象强制转换为接口类型'' Microsoft.Office.Interop.MSProject._MSProject'。此操作失败,因为由于以下错误,对IID为{00020AFF-0000-0000-C000-000000000046}的接口的COM组件的QueryInterface调用失败:RPC服务器不可用。 (来自HRESULT的异常:0x800706BA)。





当我尝试在不关闭OpenReport的情况下调用OpenReport时会引发不同的错误手动文件。



与基础RCW分离的COM对象无法使用。



I am trying to open an ms project file using the code below. The closing of the file is done manually but I want to handle the event to be able to cleanup the resources needed to be cleanup up. With this code, I have no problem when trying to open the file for the first time.

I am having problems when I manually close the file and try to call OpenReport (to reopen the file). I am getting the error:

Unable to cast COM object of type ''Microsoft.Office.Interop.MSProject.ApplicationClass'' to interface type ''Microsoft.Office.Interop.MSProject._MSProject''. This operation failed because the QueryInterface call on the COM component for the interface with IID ''{00020AFF-0000-0000-C000-000000000046}'' failed due to the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA).


A different error is thrown when I try to call OpenReport without closing the file manually.

COM object that has been separated from its underlying RCW cannot be used.

protected override void OpenReport(string filename)
{
    //projectApp is a Microsoft.Office.Interop.MSProject.ApplicationClass
    projectApp.FileOpenEx(filename, .Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, PjPoolOpen.pjDoNotOpenPool, Type.Missing, Type.Missing, Type.Missing);

    projectApp.Visible = true;
}





提前致谢。



Thanks in advance.

推荐答案

你可能适用于如何修复损坏的ms项目文件文件格式无效



文章[垃圾链接删除]可以解决您的麻烦
You may apply how to fix corrupt ms project file file format is not valid

Article [spam link removed] can solve your trouble


这篇关于重新打开MS Project文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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