Rendering Resource Usage View
Contents
[
Hide
Show
]Being able to render individual project views, for example, resource usage against tasks is a common requirement for a developer who works with Microsoft Project (MPP/XML) files. Aspose.Tasks for .NET API supports this requirement and lets you render project resources to various formats e.g. PDF. Resource usage can be rendered using Aspose.Tasks’ PresentationFormat with different timescale settings like Days, ThirdOfMonths and Months.
Rendering Resource Usage View
The code snippet in this article reads a source MPP file that has a number of resources assigned to tasks and renders these to an output PDF using the following steps:
- Create an instance of the Project Reader.
- Read the source MPP file.
- Initiate the SaveOptions object with the required timescale settings.
- Set the presentation format to Resource Sheet.
- Render the project to PDF output.
1Project project = new Project("New Project.mpp");
2// Define the SaveOptions with required TimeScale settings as Days
3SaveOptions options = new PdfSaveOptions();
4options.Timescale = Timescale.Days;
5
6// Set the Presentation format to ResourceUsage
7options.PresentationFormat = PresentationFormat.ResourceUsage;
8
9project.Save("result_ResourceUsageView_days_out.pdf", options);
10
11// Set the Timescale settings to ThirdsOfMonths and save the Project
12options.Timescale = Timescale.ThirdsOfMonths;
13project.Save("result_ResourceUsageView_thirdsOfMonths_out.pdf", options);
14
15// Set the Timescale settings to Months and save the Project
16options.Timescale = Timescale.Months;
17project.Save("result_ResourceUsageView_months_out.pdf", options);