Version

ApplyFormula Method (WorksheetCell)

Applies a formula to the cell.
Syntax
public void ApplyFormula( 
   string value
)

Parameters

value
The formula to parse and apply to the cell.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionvalue is null or empty.
FormulaParseExceptionvalue is not a valid formula.
System.InvalidOperationException The cell is part of an array formula or data table which is not confined to just the cell.
Remarks

value is parsed based on the CellReferenceMode of the Workbook to which the cell belongs. If the cell's Worksheet has been removed from its parent collection, the A1 CellReferenceMode will be used to parse the formula.

Note: it is slightly faster to use the WorksheetRow.ApplyCellFormula method, which does not create a WorksheetCell instance internally. However, if a reference to the WorksheetCell instance already exists, using this method is equivalent to using the WorksheetRow.ApplyCellFormula method.

Requirements

Target Platforms: Android 4.4+, iOS 8+

Development Environments: Visual Studio 2015+, Visual Studio for Mac Preview, Xamarin for Visual Studio 4.2+

See Also