Overtimes in Tasks

Microsoft Project lets users assign overtime to tasks. Aspose.Tasks for Java supports this functionality through two properties in the Task class.


The Task exposes several properties for working with overtime:

Microsoft Project view of task overtime

To see a task’s overtime work and cost properties:

  1. In the Task Entry form, select the Insert menu and then Column.
  2. Add the overtime columns.

Overtime columns in Microsoft Project

overtime field tasks in Microsoft Project

Getting task overtimes in Aspose.Tasks for Java

The following examples show how to get the overtime cost and work associated with a task with Aspose.Tasks.

 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(OvertimesInTasks.class);
 5// Create new project
 6Project project = new Project(dataDir + "Input.mpp");
 8for (Task tsk : project.getRootTask().getChildren()) {
 9    System.out.println(tsk.get(Tsk.OVERTIME_COST));
10    System.out.println(tsk.get(Tsk.OVERTIME_WORK).toString());
11    System.out.println(tsk.get(Tsk.PERCENT_COMPLETE));
12    System.out.println(tsk.get(Tsk.PERCENT_WORK_COMPLETE).toString());
13    System.out.println(tsk.get(Tsk.PHYSICAL_PERCENT_COMPLETE).toString());
15    // set percent complete
16    tsk.set(Tsk.PERCENT_COMPLETE, 100);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.