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

.NETのAspose.Tasksは、PDFなどのさまざまな形式へのレンダリングプロジェクトタスクをサポートしています。タスクの使用は、日、3ヶ月、月、数ヶ月などの異なるタイムスケール設定を持つAspose.Tasksの presentionformatを使用してレンダリングできます。

タスクの使用ビューをレンダリングする

この記事のコードスニペットは、割り当てられたリソースを備えた多くのタスクを備えたソースMPPファイルを読み取り、次の手順を使用してPDFを出力します。

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

Details column included in the MPP file can be rendered to the output using the View’s DisplayDetailsHeaderColumn property. This includes the list of following supported fields:

The following code sample illustrates the usage of this property.

 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);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.