Setting the Calculation Mode for a Workbook

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:

1.   Add a reference to C1.Silverlight.Excel.dlland create a C1XLBook.

2.   Add a simple formula to perform a calculation.

3.   Save the workbook. The code looks like the following. In this example it is placed within a button1_Click event so the Save As dialog box will open when the user clicks the button.

       C#

4.   Run the project and save and open the Excel file. Notice that the value for the cell in (7,1) is 120, or the total of 1*2*3*4*5, not 122, since we set the CalculationMode to Auto.

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.