リソースの使用ビューをレンダリングします

たとえば、個々のプロジェクトビューをレンダリングできることは、タスクに対するリソースの使用法を、Microsoft Project(MPP/XML)ファイルを操作する開発者にとって一般的な要件です。 C ++ APIのAspose.Tasksはこの要件をサポートし、プロジェクトリソースをさまざまな形式にレンダリングできます。 PDF。リソースの使用は、Aspose.Tasks ‘ PresentionFormatを使用して、日、3ヶ月、数ヶ月などのタイムスケール設定を使用してレンダリングできます。

リソース使用ビューのレンダリング

この記事のコードスニペットには、タスクに割り当てられた多数のリソースがあるソースMPPファイルを読み取り、次の手順を使用してこれらを出力PDFにレンダリングします。

  1. プロジェクトリーダーのインスタンスを作成します。
  2. ソースMPPファイルをお読みください。
  3. 必要なタイムスケール設定でSaveOptionsオブジェクトを開始します。
  4. プレゼンテーション形式をリソースシートに設定します。
  5. プロジェクトをPDF出力にレンダリングします。
 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.