データテーブルの配列式の計算
Contents
[
Hide
]
Microsoft Excelでデータテーブルを作成するには、データ > 何れかの分析 > データテーブル… を使用します。 Aspose.Cellsでは今、データテーブルの配列式を計算することができます。任意のタイプの数式を計算するために通常通り Workbook.CalculateFormula() を使用してください。
次のサンプルコードでは、元のExcelファイル を使用しました。セルB1の値を100に変更すると、黄色で塗られたデータテーブルの値が120になる様子が次の画像で示されます。サンプルコードは、出力PDF を生成します。
以下は元のExcelファイル から出力PDF を生成するために使用されたサンプルコードです。詳細についてはコメントをお読みください。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create workbook from source excel file | |
Workbook workbook = new Workbook(dataDir + "DataTable.xlsx"); | |
// Access first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// When you will put 100 in B1, then all Data Table values formatted as Yellow will become 120 | |
worksheet.Cells["B1"].PutValue(100); | |
// Calculate formula, now it also calculates Data Table array formula | |
workbook.CalculateFormula(); | |
// Save the workbook in pdf format | |
workbook.Save(dataDir + "output_out.pdf"); |