ワークブックの式の計算モードを設定する
Contents
[
Hide
]
Microsoft Excelでは、フォーミュラ計算モード、つまりフォーミュラの計算方法を設定できます。3つの可能な値があります。
- 自動 - 何かが変更されるたびに再計算し、ワークブックが開かれるたびに再計算します。
- データテーブル以外自動 - 何かが変更されるたびに再計算しますが、データテーブルを除外します。
- マニュアル - ユーザーがF9またはCTRL+ALT+F9を押すか、ワークブックが保存されたときにのみ再計算します。
Microsoft Excelでの式計算モードを設定するには:
- 式、次に計算オプションを選択します。 1つのオプションを選択します。
Aspose.Cellsでは、FormulaSettings.CalculationMode プロパティを使用して式計算モードを設定できます。それにはCalcModeType 列挙型を代入でき、次のいずれかの値を持ちます:
以下のサンプルコードはまずワークブックを作成し、次に式計算モードをマニュアルに設定し、ワークブックをディスク上の出力Excelファイルとして保存します。
出力ファイル。式計算モードに注意してください。
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-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(SetFormulaCalculationMode.class); | |
// Create a workbook | |
Workbook workbook = new Workbook(); | |
// Set the Formula Calculation Mode to Manual | |
workbook.getSettings().getFormulaSettings().setCalculationMode(CalcModeType.MANUAL); | |
// Save the workbook | |
workbook.save("output.xlsx", SaveFormat.XLSX); |