The CalculationMode property specifies the calculation mode for all formulas in the workbook. The CalculationMode enumeration provides three options: Manual (you manually perform the calculation), Auto (the calculation is automatically performed), or AutoNoTable (the calculation is performed except on tables).
To set the calculation mode, follow these steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim sheet As XLSheet = c1XLBook1.Sheets(0) ' simple formula sheet(7, 0).Value = "Formula: 5!" sheet(7, 1).Value = 122 sheet(7, 1).Formula = "1*2*3*4*5" c1XLBook1.CalculationMode = CalculationMode.Auto c1XLBook1.Save("c:\Save.xlsx") System.Diagnostics.Process.Start("c:\Save.xlsx") |
To write code in C#
C# |
Copy Code
|
---|---|
XLSheet sheet = c1XLBook1.Sheets[0]; // simple formula sheet[7, 0].Value = "Formula: 5!"; sheet[7, 1].Value = 122; sheet[7, 1].Formula = "1*2*3*4*5"; c1XLBook1.CalculationMode = CalculationMode.Auto; c1XLBook1.Save(@"c:\Save.xlsx"); System.Diagnostics.Process.Start(@"c:\Save.xlsx"); |