Rendering Task Usage View

In Microsoft Project, the Task Usage view shows tasks along with assigned resources and their work distribution over time.
With Aspose.Tasks for .NET, you can render this view programmatically into PDF and image formats, with customizable timescales and detail columns.

Understanding Task Usage Rendering

The PresentationFormat enumeration allows exporting project data in different layouts. When set to TaskUsage, the output provides a task-centric view with detailed resource allocations.

Supported timescales include:

This flexibility allows generating reports at different levels of granularity.

Steps to Render Task Usage View

To render the Task Usage view:

  1. Create an instance of the Project class.
  2. Load the source MPP file.
  3. Configure a SaveOptions object with the required Timescale.
  4. Set PresentationFormat to TaskUsage.
  5. Save the project to PDF or another supported format.

Example: Rendering Task Usage View to PDF

The following example shows how to render a Task Usage view:

 1Project project = new Project("New Project.mpp");
 2
 3// Define the SaveOptions with required TimeScale settings as Days
 4SaveOptions options = new PdfSaveOptions();
 5options.Timescale = Timescale.Days;
 6
 7// Set the Presentation format to ResourceUsage
 8options.PresentationFormat = PresentationFormat.TaskUsage;
 9
10project.Save("TaskUsageView_result_days_out.pdf", options);
11
12// Set the Timescale settings to ThirdsOfMonths
13options.Timescale = Timescale.ThirdsOfMonths;
14
15project.Save("TaskUsageView_result_thirdsOfMonths_out.pdf", options);
16
17// Set the Timescale settings to Months
18options.Timescale = Timescale.Months;
19
20project.Save("TaskUsageView_result_months_out.pdf", options);

Rendering Details Column in Task Usage View

The Details column from Microsoft Project can also be exported. It is enabled by setting the DisplayDetailsHeaderColumn property in the view.

Supported fields include:

Example: Rendering Task Usage View with Details Column

 1Project project = new Project("New Project.mpp");
 2
 3// Get Default view
 4UsageView view = project.DefaultView as TaskUsageView;
 5
 6// Details header column will not be displayed
 7view.DisplayDetailsHeaderColumn = false;
 8view.RepeatDetailsHeaderOnAllRows = false;
 9view.AlignDetailsData = StringAlignment.Near;
10project.Save("task usage1_out.pdf", SaveFileFormat.PDF);
11
12// Display details header column
13view.DisplayDetailsHeaderColumn = true;
14
15// Repeat details header on all assignments rows
16view.RepeatDetailsHeaderOnAllRows = true;
17view.AlignDetailsData = StringAlignment.Far;
18project.Save("task usage2_out.pdf", SaveFileFormat.PDF);

Key Notes

FAQ

Q: What is the difference between Task Usage and Resource Usage views?

Q: Can I export Task Usage with multiple baselines?

Q: Does rendering require Microsoft Project installed?

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.