Setting Formula Calculation Mode of Workbook with C++

Contents
[ ]

To set the formula calculation mode in Microsoft Excel:

  1. Select Formulas and then Calculation Options.
  2. Select one of the options.

Aspose.Cells also allows you to set the Formula Calculation Mode using FormulaSettings.GetCalculationMode() mode property. You can assign it the CalcModeType enumeration which has one of the following values:

  • CalcModeType::Automatic
  • CalcModeType::AutomaticExceptTable
  • CalcModeType::Manual
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // Source directory path
    U16String srcDir(u"..\\Data\\01_SourceDirectory\\");

    // Output directory path
    U16String outDir(u"..\\Data\\02_OutputDirectory\\");

    // Path of output excel file
    U16String outputFilePath = outDir + u"output_out.xlsx";

    // Create a workbook
    Workbook workbook;

    // Set the Formula Calculation Mode to Manual
    workbook.GetSettings().GetFormulaSettings().SetCalculationMode(CalcModeType::Manual);

    // Save the workbook
    workbook.Save(outputFilePath, SaveFormat::Xlsx);

    std::cout << "Workbook saved successfully with manual calculation mode!" << std::endl;

    Aspose::Cells::Cleanup();
}