C#读取MS Project文件

今天想做一个MS Project和SolidWorks EPDM集成的项目进度管理,刚开始做规划,所以很多东西都不会。

希望大家多指点一下,有好的建议和意见都帮忙提一下。

不多说了。

先看Project 文件的内容吧

C#读取MS Project文件

下面是读取任务名称,开始时间,结束时间。还有其他几项的代码。(vb.net)

Public Class OpreateMpp



    Public Sub ReadMpp()

        Dim message As String

        Dim missing As Object = Type.Missing

        Dim prj As New ApplicationClass

        prj.FileOpenEx("F:/项目1.mpp", False, missing, missing, missing, missing, missing, missing, missing, missing, missing, PjPoolOpen.pjPoolReadWrite, missing, missing, missing, missing)

        For Each proj As Project In prj.Projects

            For Each task As Task In proj.Tasks

                message = message + "|" + task.Name.ToString + "|" + task.UniqueID.ToString + "|" + task.ResourceNames.ToString + "|" + task.Start.ToString + "|" + task.Finish.ToString + "|" + vbLf



            Next

        Next

        prj.FileClose(PjSaveType.pjSave, False)

        prj.Quit(PjSaveType.pjSave)

        System.Console.Read()

        MsgBox(message)

    End Sub

End Class

你可能感兴趣的:(project)