C# 您将如何从 MS Project .mpp 文件中提取数据?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 09:46:06  来源:igfitidea点击:

How would you extract data from a MS Project .mpp file?

提问by Mark Nold

I need to extract data from a .mpp file on the network and combine it with other data from several different databases. The application can be written in Perl, VB6, VB.net or C# but must be easily scheduled from a Windows based server.

我需要从网络上的 .mpp 文件中提取数据,并将其与来自多个不同数据库的其他数据结合起来。该应用程序可以用 Perl、VB6、VB.net 或 C# 编写,但必须从基于 Windows 的服务器轻松调度。

What would you recommend to extract the MS Project data with no user intervention?

您建议如何在没有用户干预的情况下提取 MS Project 数据?

Is there any ODBC drivers available for MS Project?

是否有任何可用于 MS Project 的 ODBC 驱动程序?

Are there any modules (for Perl, VB, VB.net or C#) for opening a .mpp and reading activity data?

是否有任何模块(用于 Perl、VB、VB.net 或 C#)用于打开 .mpp 和读取活动数据?

采纳答案by Jon Iles

I would recommend using MPXJ (mpxj.sf.net) to extract data from Microsoft Project files. Don't be put off by the fact that it was originally a Java library - the current release of MPXJ includes native .net dlls as well as the original Java JAR file, thanks to the magic of IKVM.

我建议使用 MPXJ ( mpxj.sf.net) 从 Microsoft Project 文件中提取数据。不要因为它最初是一个 Java 库而被推迟 - MPXJ 的当前版本包括原生 .net dll 以及原始 Java JAR 文件,这要归功于 IKVM 的魔力。

Disclaimer: I maintain MPXJ.

免责声明:我维护 MPXJ。

回答by Vaibhav

MPP does have its own object model that can be used to access data in it. The info should be available here: http://msdn.microsoft.com/en-us/office/aa905469.aspx

MPP 确实有自己的对象模型,可用于访问其中的数据。该信息应在此处提供:http: //msdn.microsoft.com/en-us/office/aa905469.aspx

回答by Michael

I have the same need. Here is what I found so far. There is an OLEDB provider for microsoft projects, up to version MP 2007. If Google it, there are enough sites quoting the connection string, but here is the one quote:

我也有同样的需求。这是我到目前为止发现的。微软项目有一个 OLEDB 提供程序,版本 MP 2007。如果谷歌它,有足够的站点引用连接字符串,但这里是一个引用:

oConn.Open "Provider=Microsoft.Project.OLEDB.9.0;" & _
           "Project Name=c:\somepath\myProject.mpp"

The problem with this approach seems to be that you have to install MS Project on the server. It is nuisance in any case, and an impossibility for me using hosting environtment.

这种方法的问题似乎是您必须在服务器上安装 MS Project。无论如何,这很麻烦,而且我不可能使用托管环境。

So you are down to parsing .mpp. MPXJ is an excellent library as one commenter above suggests, and I can afford to wait, so I am waiting for them to release .NET version. If you are resolved to get it done, get the code and see what they are doing. Other then in their source code/comments there is no (to my knowledge) documentation of the format.

所以你要解析.mpp。MPXJ 是一个优秀的库,正如上面的一位评论者所建议的,我可以等待,所以我正在等待他们发​​布 .NET 版本。如果您决心完成它,请获取代码并查看他们在做什么。除此之外,在他们的源代码/评论中,没有(据我所知)格式的文档。

回答by Michael

Hope the following helps...

希望以下内容有帮助...

http://www.codeproject.com/KB/cs/PrjXlsRpt.aspx

http://www.codeproject.com/KB/cs/PrjXlsRpt.aspx

Rgds

Rgds

回答by Shahzad Latif

In order to read the MPP data you can use Aspose.Tasks for .NET. This component is a normal .NET assembly and can be used with any .NET application. It provides simple API to access project elements and data.

为了读取 MPP 数据,您可以使用Aspose.Tasks for .NET。该组件是一个普通的 .NET 程序集,可以与任何 .NET 应用程序一起使用。它提供了简单的 API 来访问项目元素和数据

Disclosure: I work as developer evangelist at Aspose.

披露:我在 Aspose 担任开发人员布道者。