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:
- Days
- ThirdOfMonths
- Months
This flexibility allows generating reports at different levels of granularity.
Steps to Render Task Usage View
To render the Task Usage view:
- Create an instance of the Project class.
- Load the source MPP file.
- Configure a SaveOptions object with the required Timescale.
- Set
PresentationFormat
to TaskUsage. - 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:
- Work
- Actual Work
- Actual Overtime Work
- Baseline Work
- Baseline 1–10 Work
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
- Task Usage view helps analyze how resources are allocated per task over time.
- Timescale options provide flexibility for reporting at daily, monthly, or custom intervals.
- The Details column makes the output more informative by including baseline and actual work metrics.
- Aspose.Tasks supports rendering to PDF, TIFF, PNG, SVG, and other image formats.
FAQ
Q: What is the difference between Task Usage and Resource Usage views?
- Task Usage groups work information by task, showing assigned resources, Resource Usage groups work information by resource, showing assigned tasks.
Q: Can I export Task Usage with multiple baselines?
- Yes. Fields such as Baseline 1–10 Work can be included in the Details column.
Q: Does rendering require Microsoft Project installed?
- No. Aspose.Tasks is a standalone library and works independently of Microsoft Project.