Editing Task Baseline Durations
Contents
[
Hide
Show
]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.
- Duration supports the TimeSpan data type.
- EstimatedDuration supports the Boolean data type.
After saving a baseline, the task baseline duration can be viewed in Microsoft Project:
- On the View menu, select More Views and ten Task Entry.
- From the Insert menu, select Columns.
- Add the Baseline Duration column.
Task baseline duration 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");