【问题标题】:How can I set the calendar property on my MSProject project?如何在我的 MSProject 项目上设置日历属性?
【发布时间】:2013-02-05 15:26:29
【问题描述】:

我有一个 MSProject 项目,我想更改正在使用的日历。问题是我找不到这个属性。

这里显示我的代码:

Microsoft.Office.Interop.MSProject.Application app = new Microsoft.Office.Interop.MSProject.Application();


 app.FileOpenEx(
                Server.MapPath("") + "\\sample.mpp",
                false,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                PjPoolOpen.pjPoolReadWrite,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing);
                pj=app.ActiveProject;

//"proyecto" is an entity
//app.GlobalBaseCalendars has all calendars
                foreach (Microsoft.Office.Interop.MSProject.Calendar calendar in app.GlobalBaseCalendars)
                {
                    if (calendar.Name == "Noche")
                    {
                        pj.Calendar.index? GUID? ...= // All properties are read-only
                    }
                }

如何设置pj.Calendar的值?

【问题讨论】:

    标签: c# interop ms-project


    【解决方案1】:

    这是项目属性是只读的许多情况之一,设置它的方法是使用应用程序的方法:

    app.ProjectSummaryInfo(
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           Type.Missing,
                           "Noche",
                           Type.Missing,
                           Type.Missing,
                           Type.Missing);
    

    【讨论】:

      猜你喜欢
      • 2013-02-20
      • 1970-01-01
      • 2011-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-06
      • 1970-01-01
      相关资源
      最近更新 更多