Ställa in formelberäkningsläge för arbetsbok med C++

Contents
[ ]

För att ställa in formelberäkningsläge i Microsoft Excel:

  1. Välj Formler och sedan Beräkningsalternativ.
  2. Välj ett av alternativen.

Aspose.Cells tillåter också att du ställer in Formelberäkningsläget med hjälp av FormulaSettings.GetCalculationMode()-lägesegenskapen. Du kan tilldela den CalcModeType-uppräkningen som har ett av följande värden:

  • 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();
}