Class FormulaSettings

FormulaSettings class

Settings of formulas and calculation.

public class FormulaSettings

Properties

NameDescription
CalculateOnOpen { get; set; }Indicates whether the application is required to perform a full calculation when the workbook is opened.
CalculateOnSave { get; set; }Indicates whether recalculate the workbook before saving the document, when in manual calculation mode.
CalculationId { get; set; }Specifies the version of the calculation engine used to calculate values in the workbook.
CalculationMode { get; set; }Gets or sets the mode for workbook calculation in ms excel.
EnableCalculationChain { get; set; }Whether enable calculation chain for formulas. Default is false.
EnableIterativeCalculation { get; set; }Indicates whether enable iterative calculation to resolve circular references.
ForceFullCalculation { get; set; }Indicates whether calculates all formulas every time when a calculation is triggered.
MaxChange { get; set; }The maximum change to resolve a circular reference.
MaxIteration { get; set; }The maximum iterations to resolve a circular reference.
PrecisionAsDisplayed { get; set; }Whether the precision of calculated result be set as they are displayed while calculating formulas
PreservePaddingSpaces { get; set; }Indicates whether preserve those spaces and line breaks that are padded between formula tokens while getting and setting formulas. Default value is false.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class FormulaSettingsDemo
    {
        public static void FormulaSettingsExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Access the workbook's formula settings
            FormulaSettings formulaSettings = workbook.Settings.FormulaSettings;

            // Setting properties
            formulaSettings.CalculateOnOpen = true;
            formulaSettings.CalculateOnSave = true;
            formulaSettings.ForceFullCalculation = false;
            formulaSettings.CalculationMode = CalcModeType.Automatic;
            formulaSettings.CalculationId = "0";
            formulaSettings.EnableIterativeCalculation = true;
            formulaSettings.MaxIteration = 100;
            formulaSettings.MaxChange = 0.001;
            formulaSettings.PrecisionAsDisplayed = false;
            formulaSettings.EnableCalculationChain = true;
            formulaSettings.PreservePaddingSpaces = false;

            // Save the workbook
            workbook.Save("FormulaSettingsExample.xlsx");
            workbook.Save("FormulaSettingsExample.pdf");
            return;
        }
    }
}

See Also