リソースの使用とリソースシートビューのレンダリング
Contents
[
Hide
Show
]タスクに対するリソースの使用など、個々のプロジェクトビューをレンダリングできることは、Microsoft Project(MPP/XML)ファイルを操作する開発者にとって一般的な要件です。 JavaのAspose.Tasksは、この要件をサポートし、プロジェクトリソースをPDFなどのさまざまな形式にレンダリングできます。リソースの使用は、日、3ヶ月、数ヶ月などの異なるタイムスケール設定を備えたAspose.TasksのPresentionFormatを使用してレンダリングできます。
リソース使用ビューのレンダリング
この記事のコードスニペットには、タスクに割り当てられた多数のリソースがあるソースMPPファイルを読み取り、次の手順を使用してこれらを出力PDFにレンダリングします。
- プロジェクトリーダーのインスタンスを作成します。
- ソースMPPファイルをお読みください。
- 必要なタイムスケール設定でSaveOptionsオブジェクトを開始します。
- プレゼンテーション形式をリソースシートに設定します。
- プロジェクトをPDF出力にレンダリングします。
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(RenderResourceUsageandsheetView.class);
4
5// Read the source Project
6Project project = new Project(dataDir + "RenderMe.mpp");
7// Define the SaveOptions with required TimeScale settings as Days
8SaveOptions options = new PdfSaveOptions();
9options.setTimescale(Timescale.Days);
10// Set the Presentation format to ResourceUsage
11options.setPresentationFormat(PresentationFormat.ResourceUsage);
12String days = "result_days.pdf";
13project.save(days, options);
14
15// Set the Tiemscale settings to ThirdsOfMonths
16options.setTimescale(Timescale.ThirdsOfMonths);
17String thirds = "result_thirdsOfMonths.pdf";
18project.save(thirds, options);
19
20// Set the Timescale settings to Months
21options.setTimescale(Timescale.Months);
22String months = "result_months.pdf";
23// Save the project
24project.save(months, options);
Rendering Resource Sheet View
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(RenderResourceUsageandsheetView.class);
4
5// Read the source Project
6Project project = new Project(dataDir + "TASKSNET_33285.mpp");
7// Define the SaveOptions
8SaveOptions options = new PdfSaveOptions();
9
10// Set the Presentation format to ResourceSheet
11options.setPresentationFormat(PresentationFormat.ResourceSheet);
12project.save("result.pdf", options);