2013-02-05 47 views
1

我有一個MSProject項目,我想更改正在使用的日曆。問題是我找不到這個屬性。如何在我的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價值?

回答

0

這是在許多情況下,項目屬性爲只讀,並設置它使用應用程序的方法,該方法之一:

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); 
+0

已經嘗試過了,它的工作原理。 – Esneyder

相關問題