Einstellen des Formelberechnungsmodus der Arbeitsmappe mit C++

Contents
[ ]

Um den Formelberechnungsmodus in Microsoft Excel festzulegen:

  1. Wählen Sie Formeln und dann Berechnungsoptionen.
  2. Wählen Sie eine der Optionen aus.

Aspose.Cells ermöglicht Ihnen auch, den Formelberechnungsmodus mit Hilfe des FormulaSettings.GetCalculationMode()-Modus-Attributs festzulegen. Sie können ihm die CalcModeType-Enumeration zuweisen, die einen der folgenden Werte hat:

  • CalcModeType::Automatic
  • CalcModeType::AutomaticExceptTable
  • CalcModeType::Manuell
#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();
}