Class GridFormulaParsingEventArgs
Used by the GridFormulaParsingEventArgs event, GridFormulaParsingEventArgs holds a reference to the string that is to be parsed. The GridFormulaParsing event allows the listener to preprocess the string that is being parsed.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridFormulaParsingEventArgs : EventArgs
Remarks
Please note that this event may be raised more than once as a string is parsed.
Examples
Here is a code snippet that shows how to tell a grid to also treat any text in a formula cell that begins with a minus(-) or a plus(+) as formulas. The default behavior is to treat only text beginning with equal(=) as formulas.
//subscribe to the event before any formulas are loaded into the grid...
this.engine = ((GridFormulaCellModel)gridControl1.CellModels["FormulaCell"]).Engine;
this.engine.FormulaParsing += new GridFormulaParsingEventHandler(engine_FormulaParsing);
//Here is the handler code that adds an = if necessary so any string beginning with +, - or =
//is treated as a formula.
void engine_FormulaParsing(object sender, GridFormulaParsingEventArgs e)
{
//allow cells starting with + and - to be treated as formula cells.
if (e.Text.StartsWith("-"))
e.Text = "=" + e.Text;
else if (e.Text.StartsWith("+"))
e.Text = "=" + e.Text.Substring(1);
}
Constructors
GridFormulaParsingEventArgs()
Initializes a new instance of the GridFormulaParsingEventArgs class.
Declaration
public GridFormulaParsingEventArgs()
GridFormulaParsingEventArgs(String)
Initializes a new instance of the GridFormulaParsingEventArgs class. Holds a reference to the string that is to be parsed..
Declaration
public GridFormulaParsingEventArgs(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The formula that is to be parsed. |
Properties
Text
Gets or sets the formula about to be parsed.
Declaration
public string Text { get; set; }
Property Value
Type |
---|
System.String |