数式の操作

Microsoft Project の数式は、計算を自動化し、カスタム ロジックを作成し、レポート機能を強化することを可能にします。
使用して Aspose.Tasks for .NET、開発者は MPP ファイルの数式をプログラムで操作できます。定義や編集からプロジェクトへの保存まで行えます。

このセクションでは、Aspose.Tasks における数式の使用方法の概要を以下の項目とともに説明します:

はじめに

Aspose.Tasks で数式の操作を始めるには:

  1. 既存のプロジェクトを読み込むか、新しいプロジェクトを作成します。
  2. 必要なカスタム フィールド定義にアクセスします。
  3. フィールドに数式を割り当てます。
  4. プロジェクトを MPP 形式で保存します。

例:タスク フィールドに数式を割り当てる

 1class Program
 2{
 3    static void Main()
 4    {
 5        // Load project
 6        var project = new Project("input.mpp");
 7
 8        // Define a custom task field
 9        ExtendedAttributeDefinition attr = ExtendedAttributeDefinition.CreateTaskDefinition(
10            CustomFieldType.Number,
11            ExtendedAttributeTask.Number1,
12            "CustomFormulaField");
13
14        project.ExtendedAttributes.Add(attr);
15
16        // Assign a formula to the field
17        attr.Formula = "[Actual Duration] / [Duration]";
18
19        // Save result
20        project.Save("output.mpp", SaveFileFormat.Mpp);
21    }
22}

この例では、数式がタスクの期間と標準レートに基づいてカスタム値を計算します。

関連トピック

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.