Table of Contents

Class CalculationExtension

Namespace
OfficeOpenXml
Assembly
EPPlus.dll

Extentions methods for formula calculation.

public static class CalculationExtension
Inheritance
CalculationExtension
Inherited Members

Methods

Calculate(ExcelRangeBase)

Calculate all formulas in the current range

public static void Calculate(this ExcelRangeBase range)

Parameters

range ExcelRangeBase

The range

Calculate(ExcelRangeBase, ExcelCalculationOption)

Calculate all formulas in the current range

public static void Calculate(this ExcelRangeBase range, ExcelCalculationOption options)

Parameters

range ExcelRangeBase

The range

options ExcelCalculationOption

Calculation options

Calculate(ExcelRangeBase, Action<ExcelCalculationOption>)

Calculate all formulas in the current range

public static void Calculate(this ExcelRangeBase range, Action<ExcelCalculationOption> configHandler)

Parameters

range ExcelRangeBase

The range to calculate

configHandler Action<ExcelCalculationOption>

Configuration handler

Examples

sheet.Cells["A1:A3"].Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);

Calculate(ExcelWorkbook)

Calculate all formulas in the current workbook

public static void Calculate(this ExcelWorkbook workbook)

Parameters

workbook ExcelWorkbook

The workbook

Calculate(ExcelWorkbook, ExcelCalculationOption)

Calculate all formulas in the current workbook

public static void Calculate(this ExcelWorkbook workbook, ExcelCalculationOption options)

Parameters

workbook ExcelWorkbook

The workbook

options ExcelCalculationOption

Calculation options

Calculate(ExcelWorkbook, Action<ExcelCalculationOption>)

Calculate all formulas in the current workbook

public static void Calculate(this ExcelWorkbook workbook, Action<ExcelCalculationOption> configHandler)

Parameters

workbook ExcelWorkbook

The workbook to calculate

configHandler Action<ExcelCalculationOption>

Configuration handler

Examples

workbook.Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);

Calculate(ExcelWorksheet)

Calculate all formulas in the current worksheet

public static void Calculate(this ExcelWorksheet worksheet)

Parameters

worksheet ExcelWorksheet

The worksheet

Calculate(ExcelWorksheet, ExcelCalculationOption)

Calculate all formulas in the current worksheet

public static void Calculate(this ExcelWorksheet worksheet, ExcelCalculationOption options)

Parameters

worksheet ExcelWorksheet

The worksheet

options ExcelCalculationOption

Calculation options

Calculate(ExcelWorksheet, Action<ExcelCalculationOption>)

Calculate all formulas in the current range

public static void Calculate(this ExcelWorksheet worksheet, Action<ExcelCalculationOption> configHandler)

Parameters

worksheet ExcelWorksheet

The worksheet to calculate

configHandler Action<ExcelCalculationOption>

Configuration handler

Examples

sheet.Calculate(opt => opt.PrecisionAndRoundingStrategy = PrecisionAndRoundingStrategy.Excel);

Calculate(ExcelWorksheet, string)

Calculate all formulas in the current range

public static object Calculate(this ExcelWorksheet worksheet, string Formula)

Parameters

worksheet ExcelWorksheet

The worksheet

Formula string

The formula to be calculated

Returns

object

The result of the formula calculation

Calculate(ExcelWorksheet, string, ExcelCalculationOption)

Calculate all formulas in the current range

public static object Calculate(this ExcelWorksheet worksheet, string Formula, ExcelCalculationOption options)

Parameters

worksheet ExcelWorksheet

The worksheet

Formula string

The formula to be calculated

options ExcelCalculationOption

Calculation options

Returns

object

The result of the formula calculation