ig.excel.Formula
Remarks
Formulas provide a way to show dynamic values in a cell. The value could be based any number of factors, such as the values of other cells and the time of day. Those alternate cells can even exist in different workbook files on the user's machine or on the internet.
See Microsoft Excel help for more information on formulas.
Use one of the Parse or TryParse overloads to create a new formula.
Dependencies
-
applyTo
- .applyTo( regions:ig.excel.WorksheetRegion[] );
Applies the formula to all specified regions of cells.
- regions
- Type:ig.excel.WorksheetRegion[]
- The regions of cells to apply the formula to.
Exceptions
Exception Description ig.ArgumentNullException regions is null. ig.ArgumentException regions has a length of 0. ig.ArgumentException Not all regions specified are from the same worksheet. ig.InvalidOperationException One or more regions specified contain array formulas or data tables which extend outside the region. Remarks
This method, or one of the other ApplyTo overrides must be used to set the value of a cell to a formula.
After this method returns, the WorksheetCell.formula of all cells in all specified regions will return the formula.
-
applyTo
- .applyTo( cell:ig.excel.WorksheetCell );
Applies the formula to the specified cell.
- cell
- Type:ig.excel.WorksheetCell
- The cell to apply the formula to.
Exceptions
Exception Description ig.ArgumentNullException cell is null. ig.InvalidOperationException cell is part of an array formula or data table which is not confined to just the cell. Remarks
This method, or one of the other ApplyTo overrides must be used to set the value of a cell to a formula.
After this method returns, the WorksheetCell.formula of the specified cell will return the formula.
-
applyTo
- .applyTo( region:ig.excel.WorksheetRegion );
Applies the formula to the specified region of cells.
- region
- Type:ig.excel.WorksheetRegion
- The region of cells to apply the formula to.
Exceptions
Exception Description ig.ArgumentNullException region is null. ig.InvalidOperationException region contains an array formula or data table which extends outside the region. Remarks
This method, or one of the other ApplyTo overrides must be used to set the value of a cell to a formula.
After this method returns, the WorksheetCell.formula of all cells in the specified region will return the formula.
-
areEqual
- .areEqual( formulaA:ig.excel.Formula, formulaB:ig.excel.Formula, cellReferenceMode:ig.excel.CellReferenceMode );
- Return Type:
- boolean
- Return Type Description:
- True if the formulas are both null or both equivalent; False otherwise.
Determines whether two Formula instances are equal using the specified cell reference mode.
- formulaA
- Type:ig.excel.Formula
- The first Formula to compare.
- formulaB
- Type:ig.excel.Formula
- The second Formula to compare.
- cellReferenceMode
- Type:ig.excel.CellReferenceMode
- The cell reference mode to use when comparing the two formulas.
Remarks
This essentially performs a case-insensitive string comparison, ignoring the white space in the formula. -
parse
- .parse( value:string, cellReferenceMode:ig.excel.CellReferenceMode );
- Return Type:
- ig.excel.Formula
- Return Type Description:
- A Formula instance which represents the formula specified.
Parses the specified formula value and returns the formula which was created from it.
- value
- Type:string
- The string which defines the formula to parse.
- cellReferenceMode
- Type:ig.excel.CellReferenceMode
- The mode used to interpret cell references in the formula.
Exceptions
Exception Description ig.ArgumentNullException value is null or empty. ig.excel.InvalidEnumArgumentException cellReferenceMode is not defined in the CellReferenceMode enumeration. ig.excel.FormulaParseException value is not a valid formula. -
parse
- .parse( value:string, cellReferenceMode:ig.excel.CellReferenceMode, fileFormat:ig.excel.WorkbookFormat );
- Return Type:
- ig.excel.Formula
- Return Type Description:
- A Formula instance which represents the formula specified.
Parses the specified formula value and returns the formula which was created from it.
- value
- Type:string
- The string which defines the formula to parse.
- cellReferenceMode
- Type:ig.excel.CellReferenceMode
- The mode used to interpret cell references in the formula.
- fileFormat
- Type:ig.excel.WorkbookFormat
- The file format to use when parsing the formula. This will be used to determine certain limits which are format dependant.
Exceptions
Exception Description ig.ArgumentNullException value is null or empty. ig.excel.InvalidEnumArgumentException cellReferenceMode is not defined in the CellReferenceMode enumeration. ig.excel.InvalidEnumArgumentException fileFormat is not defined in the WorkbookFormat enumeration. ig.excel.FormulaParseException value is not a valid formula. -
parse
- .parse( value:string, cellReferenceMode:ig.excel.CellReferenceMode, fileFormat:ig.excel.WorkbookFormat, culture:string );
- Return Type:
- ig.excel.Formula
- Return Type Description:
- A Formula instance which represents the formula specified.
Parses the specified formula value and returns the formula which was created from it.
- value
- Type:string
- The string which defines the formula to parse.
- cellReferenceMode
- Type:ig.excel.CellReferenceMode
- The mode used to interpret cell references in the formula.
- fileFormat
- Type:ig.excel.WorkbookFormat
- The file format to use when parsing the formula. This will be used to determine certain limits which are format dependant.
- culture
- Type:string
- The culture used to parse the formula.
Exceptions
Exception Description ig.ArgumentNullException value is null or empty. ig.excel.InvalidEnumArgumentException cellReferenceMode is not defined in the CellReferenceMode enumeration. ig.excel.InvalidEnumArgumentException fileFormat is not defined in the WorkbookFormat enumeration. ig.excel.FormulaParseException value is not a valid formula. -
parse
- .parse( value:string, cellReferenceMode:ig.excel.CellReferenceMode, culture:string );
- Return Type:
- ig.excel.Formula
- Return Type Description:
- A Formula instance which represents the formula specified.
Parses the specified formula value and returns the formula which was created from it.
- value
- Type:string
- The string which defines the formula to parse.
- cellReferenceMode
- Type:ig.excel.CellReferenceMode
- The mode used to interpret cell references in the formula.
- culture
- Type:string
- The culture used to parse the formula.
Exceptions
Exception Description ig.ArgumentNullException value is null or empty. ig.excel.InvalidEnumArgumentException cellReferenceMode is not defined in the CellReferenceMode enumeration. ig.excel.FormulaParseException value is not a valid formula. -
toString
- .toString( );
- Return Type:
- string
- Return Type Description:
- The string representing the formula.
Converts the formula to a string representation, similar to the string with which it was created. This uses the CellReferenceMode with which the formula was created to create cell reference strings.
-
toString
- .toString( cellReferenceMode:ig.excel.CellReferenceMode );
- Return Type:
- string
- Return Type Description:
- The string representing the formula.
Converts the formula to a string representation, similar to the string with which it was created.
- cellReferenceMode
- Type:ig.excel.CellReferenceMode
- The cell reference mode used to create cell reference strings.
-
toString
- .toString( cellReferenceMode:ig.excel.CellReferenceMode, culture:string );
- Return Type:
- string
- Return Type Description:
- The string representing the formula.
Converts the formula to a string representation, similar to the string with which it was created.
- cellReferenceMode
- Type:ig.excel.CellReferenceMode
- The cell reference mode used to create cell reference strings.
- culture
- Type:string
- The culture used to generate the formula string.