Editing Task Baseline Durations

Task Baseline Duration

The Duration and EstimatedDuration properties of the TaskBaseLine class can be used to read and write the scheduled duration when the baseline was saved and determine whether the scheduled duration was estimated or not respectively.

After saving a baseline, the task baseline duration can be viewed in Microsoft Project:

  1. On the View menu, select More Views and ten Task Entry.
  2. From the Insert menu, select Columns.
  3. Add the Baseline Duration column.

Task baseline duration in Microsoft Project

compare task baselines in Microsoft Project

Getting Task Baseline Duration using Aspose.Tasks

The code below displays the task baseline duration in the console window after traversing the task baselines of a task.

 1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
 2// The path to the documents directory.
 3String dataDir = Utils.getDataDir(TaskBaselineDuration.class);
 4
 5long OneSec = 10000000;// microsecond * 10
 6long OneMin = 60 * OneSec;
 7long OneHour = 60 * OneMin;
 8
 9Project project = new Project();
10// Creating TaskBaseline:
11Task task = project.getRootTask().getChildren().add("Task");
12project.setBaseline(BaselineType.Baseline);
13
14TaskBaseline baseline = task.getBaselines().toList().get(0);
15System.out.println(baseline.getDuration().toDouble() / OneHour + " Hours");
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.