Project newProject = new Project();Task T1 = newProject.RootTask.Children.Add();T1.Set(Tsk.Name, "Teste 1");T1.Set(Tsk.Start, new DateTime(2015, 9, 5));T1.Set(Tsk.Duration, newProject.GetDuration(3, TimeUnitType.Day));T1.Set(Tsk.ConstraintType, ConstraintType.StartNoEarlierThan);T1.Set(Tsk.ConstraintDate, new DateTime(2015, 9, 5));Task T2 = newProject.RootTask.Children.Add();T2.Set(Tsk.Name, "Teste 2");T2.Set(Tsk.Start, new DateTime(2015, 9, 11));T2.Set(Tsk.Duration, newProject.GetDuration(7, TimeUnitType.Day));T2.Set(Tsk.ConstraintType, ConstraintType.StartNoEarlierThan);T2.Set(Tsk.ConstraintDate, new DateTime(2015, 9, 5));newProject.Save("C:\\TestFile.mpx", Aspose.Tasks.Saving.SaveFileFormat.MPX);
Project newProject = new Project();
Calendar cal = newProject.Calendars.GetByUid(1);
foreach (WeekDay wday in cal.WeekDays)
Console.WriteLine(wday.DayType + “::” + wday.DayWorking);
Thanks for the fast reply.
Thank you for sharing your feedback.
We were able to reproduce this issue at our end and have logged it as TASKS-34170 in our issue tracking system. Our product team will investigate it further and we’ll notify you here once there is some information available in this regard.
The issues you have found earlier (filed as TASKS-34170) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
I have a query - I am taking data from database with start and end date and I am calculating the duration based on start and end date and we do consider saturday sunday also as working days. But when I convert to Mpp file it considers Saturday and Sunday as non-working day. Could you please advise if there’s any method to consider them under working day as well.
We are looking into your requirements and will soon assist you further in this regard.
Thank you for contacting Aspose support team.
You need to define a calendar with 7 working days and set it to project. After this when duration is taken, it considers all days as working. Following sample code is working fine with XML file. You may please try it with your sample template MPP file, save output to MPP and share the feedback.
Project project = new Project(); // Define Calendar Aspose.Tasks.Calendar cal = project.Calendars.Add("Calendar1"); // Add working days monday through thursday with default timings cal.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Monday)); cal.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Tuesday)); cal.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Wednesday)); cal.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Thursday)); cal.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Friday)); cal.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Saturday)); cal.WeekDays.Add(WeekDay.CreateDefaultWorkingDay(DayType.Sunday)); project.Set(Prj.Calendar, cal); var task1 = project.RootTask.Children.Add("Task 1"); task1.Set(Tsk.Start, new DateTime(2018,8,16,8,0,0)); task1.Set(Tsk.Duration, project.GetDuration(10, TimeUnitType.Day)); // Save the Project project.Save(path + "Project_DefineCalendarWeekdays_out.xml", Aspose.Tasks.Saving.SaveFileFormat.XML);
Thanks for your response. I have set Actual_start and Actual_end date in Task instead of Start and Finish parameter and it worked. Its taking the original data I am getting from database and printing.