It appears there may be a rounding difference between Aspose and MS Project.
I have a simple project with only a couple tasks created in MS Project.
- The project is using a standard calendar M-F, with 8 hour workdays (1 hr lunch break).
These are the steps:
- Using Aspose, I create a project
- Add a task with 9 hour duration.
- Convert the task to days.
- Export the project to xml
- Export the project to mpp format.
Duration from exported XML
- PT9H0M0S.
Duration from exported mpp (Viewed in MS Project)
- Duration = 9 hrs
- Start = 6/6/22 8:00AM
- Finish = 6/7/22 9:00AM
If create the same task with Duration = 1.13 directly in MS Project, the calculated end date is different.
- Duration = 1.13 days
- Start = 6/6/22 8:00AM
- Finish = 6/7/22 9:02AM
Any recommendation for working around this?
Project project = new Project();
project.Set(Prj.StartDate, new DateTime(2022,6,6,8,0,0));
project.CalculationMode = Aspose.Tasks.CalculationMode.Manual;
Aspose.Tasks.Task childTask1 = project.RootTask.Children.Add("Pilot Survey");
childTask1.Set(Tsk.IsManual, false);
childTask1.Set(Tsk.Start, new DateTime(2022, 6, 6, 8, 0, 0));
childTask1.Set(Tsk.Duration, project.GetDuration(9, TimeUnitType.Hour));
project.Save("Rounding_Before.mpp", SaveFileFormat.Mpp);
project.Save("Rounding_Before.xml", SaveFileFormat.Xml);
Console.WriteLine("Uid: {0} Dur: {1} TS: {2} Start: {3} Finish: {4}", childTask1.Get(Tsk.Uid), childTask1.Get(Tsk.Duration), childTask1.Get(Tsk.Duration).TimeSpan, childTask1.Get(Tsk.Start), childTask1.Get(Tsk.Finish));
Console.WriteLine("");
childTask1.Set(Tsk.Duration, childTask1.Get(Tsk.Duration).Convert(TimeUnitType.Day));
Console.WriteLine("Uid: {0} Dur: {1} TS: {2} Start: {3} Finish: {4}", childTask1.Get(Tsk.Uid), childTask1.Get(Tsk.Duration), childTask1.Get(Tsk.Duration).TimeSpan, childTask1.Get(Tsk.Start), childTask1.Get(Tsk.Finish));
project.Save("Rounding_After.mpp", SaveFileFormat.Mpp);
project.Save("Rounding_After.xml", SaveFileFormat.Xml);
image.png (13.6 KB)
Rounding.zip (53.5 KB)
image.png (12.7 KB)