Class CalculationExtension
Extentions methods for formula calculation.
Inheritance
Inherited Members
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public static class CalculationExtension
  Methods
Calculate(ExcelRangeBase)
Calculate all formulas in the current range
Declaration
public static void Calculate(this ExcelRangeBase range)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelRangeBase | range | The range  | 
      
Calculate(ExcelRangeBase, ExcelCalculationOption)
Calculate all formulas in the current range
Declaration
public static void Calculate(this ExcelRangeBase range, ExcelCalculationOption options)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelRangeBase | range | The range  | 
      
| ExcelCalculationOption | options | Calculation options  | 
      
Calculate(ExcelRangeBase, Action<ExcelCalculationOption>)
Calculate all formulas in the current range
Declaration
public static void Calculate(this ExcelRangeBase range, Action<ExcelCalculationOption> configHandler)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelRangeBase | range | The range to calculate  | 
      
| System.Action<ExcelCalculationOption> | configHandler | Configuration handler  | 
      
Examples
sheet.Cells["A1:A3"].Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);
  
  Calculate(ExcelWorkbook)
Calculate all formulas in the current workbook
Declaration
public static void Calculate(this ExcelWorkbook workbook)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelWorkbook | workbook | The workbook  | 
      
Calculate(ExcelWorkbook, ExcelCalculationOption)
Calculate all formulas in the current workbook
Declaration
public static void Calculate(this ExcelWorkbook workbook, ExcelCalculationOption options)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelWorkbook | workbook | The workbook  | 
      
| ExcelCalculationOption | options | Calculation options  | 
      
Calculate(ExcelWorkbook, Action<ExcelCalculationOption>)
Calculate all formulas in the current workbook
Declaration
public static void Calculate(this ExcelWorkbook workbook, Action<ExcelCalculationOption> configHandler)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelWorkbook | workbook | The workbook to calculate  | 
      
| System.Action<ExcelCalculationOption> | configHandler | Configuration handler  | 
      
Examples
workbook.Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);
  
  Calculate(ExcelWorksheet)
Calculate all formulas in the current worksheet
Declaration
public static void Calculate(this ExcelWorksheet worksheet)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelWorksheet | worksheet | The worksheet  | 
      
Calculate(ExcelWorksheet, ExcelCalculationOption)
Calculate all formulas in the current worksheet
Declaration
public static void Calculate(this ExcelWorksheet worksheet, ExcelCalculationOption options)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelWorksheet | worksheet | The worksheet  | 
      
| ExcelCalculationOption | options | Calculation options  | 
      
Calculate(ExcelWorksheet, Action<ExcelCalculationOption>)
Calculate all formulas in the current range
Declaration
public static void Calculate(this ExcelWorksheet worksheet, Action<ExcelCalculationOption> configHandler)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelWorksheet | worksheet | The worksheet to calculate  | 
      
| System.Action<ExcelCalculationOption> | configHandler | Configuration handler  | 
      
Examples
sheet.Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);
  
  Calculate(ExcelWorksheet, String)
Calculate all formulas in the current range
Declaration
public static object Calculate(this ExcelWorksheet worksheet, string Formula)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelWorksheet | worksheet | The worksheet  | 
      
| System.String | Formula | The formula to be calculated  | 
      
Returns
| Type | Description | 
|---|---|
| System.Object | The result of the formula calculation  | 
      
Calculate(ExcelWorksheet, String, ExcelCalculationOption)
Calculate all formulas in the current range
Declaration
public static object Calculate(this ExcelWorksheet worksheet, string Formula, ExcelCalculationOption options)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ExcelWorksheet | worksheet | The worksheet  | 
      
| System.String | Formula | The formula to be calculated  | 
      
| ExcelCalculationOption | options | Calculation options  | 
      
Returns
| Type | Description | 
|---|---|
| System.Object | The result of the formula calculation  |