Render 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 C++ 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:

  1. Create an instance of Project Reader.
  2. Read the source MPP file.
  3. Initiate the SaveOptions object with the required timescale settings.
  4. Set the presentation format to Resource Sheet.
  5. Render the project to PDF output.
 1// Create project instance
 2System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"ResourceUsageView.mpp");
 3    
 4// Define the SaveOptions with required TimeScale settings as Days
 5System::SharedPtr<SaveOptions> options = System::MakeObject<PdfSaveOptions>();
 6options->set_Timescale(Aspose::Tasks::Visualization::Timescale::Days);
 7    
 8// Set the Presentation format to ResourceUsage
 9options->set_PresentationFormat(Aspose::Tasks::Visualization::PresentationFormat::ResourceUsage);
10    
11// Save the Project
12System::String outputFile = u"result_ResourceUsageView_days_out.pdf";
13project1->Save(dataDir + outputFile, options);
14    
15// Set the Tiemscale settings to ThirdsOfMonths and save the Project
16options->set_Timescale(Aspose::Tasks::Visualization::Timescale::ThirdsOfMonths);
17outputFile = u"result_ResourceUsageView_thirdsOfMonths_out.pdf";
18project1->Save(dataDir + outputFile, options);
19    
20// Set the Timescale settings to Months and save the Project
21options->set_Timescale(Aspose::Tasks::Visualization::Timescale::Months);
22outputFile = u"result_ResourceUsageView_months_out.pdf";
23project1->Save(dataDir + outputFile, options);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.