FlexCelReport.SetExpression Method
Sets a user-defined expression to be used in the report. Different from SetValue this method will evaluate the <#tags> in "value". This allows you to provide formula functionality to end users, and to reuse the same report for different formulas.
Syntax
Namespace: FlexCel.Report
public void SetExpression(String name, Object value)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
name | String | Name of the expression to set. Case insensitive. | |
value | Object | Value of the expression. |
Examples
You could ask the user for an expression in an edit box, and then before running the report do:
flexCelReport.SetExpression("MyExpression", EditBox.Text);
Then, if you write <#MyExpresion> on a cell, the expression will be evaluated and entered into the cell. If the user enters "<#evaluate(<#Order.Amount> * <#Order.Vat>)>" in the edit box, this formula will be evaluated into the cell. The user can write any <#tag> that could be used in an expression defined directly in the template.