NanoXLSX.Core 3.2.1
Loading...
Searching...
No Matches
NanoXLSX.FormulaData Class Reference

Class representing a formula in a cell, its data, respectively. More...

Inheritance diagram for NanoXLSX.FormulaData:

Public Types

enum  FormulaType { Normal , Array , Shared , DataTable }
 Enum to define the specific type of a formal if the Cell has the type Cell.CellType.Formula. More...

Public Member Functions

 FormulaData ()
 Default constructor.
 FormulaData (string expression, object cachedValue=null)
 Constructor with formula expression and optional cached value to create a formula of the common type FormulaType.Normal.
int CompareTo (FormulaData other)
 Compares this instance with another FormulaData instance.
bool Equals (FormulaData other)
 Determines whether the specified FormulaData instance is equal to this instance.
override bool Equals (object obj)
 Determines whether the specified object is equal to this instance.
override int GetHashCode ()
 Returns a hash code consistent with Equals(FormulaData).

Properties

string Expression [get, set]
 Gets the formula expression as string. This value is currently identical with Cell.Value if Cell.DataType is set to Cell.CellType.Formula.
bool HasExternalReferences [get, set]
 Gets whether the formula expression contains a reference to an external workbook.
FormulaType Type [get, set]
 Type of the formula. Default is FormulaType.Normal.
string FormulaRange [get, set]
 Gets the range associated with an array, shared, or data-table formula. Can be a range or address (string representation). Default is null, if no reference was defined.
DefinedName DefinedNameReference [get, set]
 Resolved defined name, if the complete formula expression is a direct reference to exactly one defined name.
object CachedValue [get, set]
 Gets the cached value of the formula.
Cell.CellType CachedValueType [get, set]
 Gets the data type of CachedValue. The default is Cell.CellType.Default if no cached value or no supported cached value type is available.
string MasterCellAddress [get, set]
 Gets the address of the formula's master cell. This is mainly used in case of FormulaType.Array.

Detailed Description

Class representing a formula in a cell, its data, respectively.

Definition at line 19 of file FormulaData.cs.

Member Enumeration Documentation

◆ FormulaType

Enum to define the specific type of a formal if the Cell has the type Cell.CellType.Formula.

Enumerator
Normal 

Cell contains a regular formula (e.g "A1+A2").

Array 

Cell contains a formula that is part of an array.

Shared 

Cell contains a shared formula, pointing to another formula that is identical.

DataTable 

Cell contains a formula that is applied across a range of one or more cells.

Definition at line 27 of file FormulaData.cs.

Constructor & Destructor Documentation

◆ FormulaData() [1/2]

NanoXLSX.FormulaData.FormulaData ( )

Default constructor.

Definition at line 133 of file FormulaData.cs.

◆ FormulaData() [2/2]

NanoXLSX.FormulaData.FormulaData ( string expression,
object cachedValue = null )

Constructor with formula expression and optional cached value to create a formula of the common type FormulaType.Normal.

Parameters
expressionFormula expression (without leading equal sign)
cachedValueOptional cached value. Default is null
Remarks
A basic validity checks (not full parsing) will perform on the expression, e.g. existence of an external link in the formula

Definition at line 145 of file FormulaData.cs.

Member Function Documentation

◆ CompareTo()

int NanoXLSX.FormulaData.CompareTo ( FormulaData other)

Compares this instance with another FormulaData instance.

Parameters
otherOther formula data instance, or null.
Returns
Negative, zero, or positive integer following the standard comparison contract.

Definition at line 215 of file FormulaData.cs.

◆ Equals() [1/2]

bool NanoXLSX.FormulaData.Equals ( FormulaData other)

Determines whether the specified FormulaData instance is equal to this instance.

Parameters
otherOther formula data instance, or null.
Returns
True if equal, otherwise false.

Definition at line 259 of file FormulaData.cs.

◆ Equals() [2/2]

override bool NanoXLSX.FormulaData.Equals ( object obj)

Determines whether the specified object is equal to this instance.

Parameters
objOther object, or null.
Returns
True if equal, otherwise false.

Definition at line 283 of file FormulaData.cs.

◆ GetHashCode()

override int NanoXLSX.FormulaData.GetHashCode ( )

Returns a hash code consistent with Equals(FormulaData).

Returns
Hash code derived from this instance's properties.

Definition at line 292 of file FormulaData.cs.

Property Documentation

◆ CachedValue

object NanoXLSX.FormulaData.CachedValue
getset

Gets the cached value of the formula.

Remarks
This value can be supplied through the constructor or set when a Workbook is loaded. Formula error results are represented by Errors.FormulaError values. The value is not evaluated when a new formula was defined by Worksheet.AddCellFormula(string, int, int) or its overload methods.

Definition at line 108 of file FormulaData.cs.

◆ CachedValueType

Cell.CellType NanoXLSX.FormulaData.CachedValueType
getset

Gets the data type of CachedValue. The default is Cell.CellType.Default if no cached value or no supported cached value type is available.

Definition at line 114 of file FormulaData.cs.

◆ DefinedNameReference

DefinedName NanoXLSX.FormulaData.DefinedNameReference
getset

Resolved defined name, if the complete formula expression is a direct reference to exactly one defined name.

Remarks
Defined names within a formula expression are currently not resolved and will not be set in this property, even if only one defined name occurs in the expression.

Definition at line 93 of file FormulaData.cs.

◆ Expression

string NanoXLSX.FormulaData.Expression
getset

Gets the formula expression as string. This value is currently identical with Cell.Value if Cell.DataType is set to Cell.CellType.Formula.

Definition at line 56 of file FormulaData.cs.

◆ FormulaRange

string NanoXLSX.FormulaData.FormulaRange
getset

Gets the range associated with an array, shared, or data-table formula. Can be a range or address (string representation). Default is null, if no reference was defined.

Definition at line 87 of file FormulaData.cs.

◆ HasExternalReferences

bool NanoXLSX.FormulaData.HasExternalReferences
getset

Gets whether the formula expression contains a reference to an external workbook.

Definition at line 69 of file FormulaData.cs.

◆ MasterCellAddress

string NanoXLSX.FormulaData.MasterCellAddress
getset

Gets the address of the formula's master cell. This is mainly used in case of FormulaType.Array.

Definition at line 119 of file FormulaData.cs.

◆ Type

FormulaType NanoXLSX.FormulaData.Type
getset

Type of the formula. Default is FormulaType.Normal.

Definition at line 82 of file FormulaData.cs.


The documentation for this class was generated from the following file: