Class CodeProvider
Provides a set of methods working with the report code compilation.
Namespace: FastReport.Code
Assembly: FastReport.Base.dll
Syntax
public abstract class CodeProvider
Constructors
CodeProvider(Report)
Initializes a new instance of CodeProvider class.
Declaration
public CodeProvider(Report report)
Parameters
Type | Name | Description |
---|---|---|
Report | report |
Properties
DefaultProvider
Gets or sets a default code provider class.
Declaration
public static Type DefaultProvider { get; set; }
Property Value
Type | Description |
---|---|
System.Type |
Remarks
Default value is MsCodeProvider. Assigning a null to this property resets it to default value.
Report
Gets a report instance.
Declaration
public Report Report { get; }
Property Value
Type | Description |
---|---|
Report |
Methods
CalcExpression(String, Variant)
Returns an expression value.
Declaration
public virtual object CalcExpression(string expression, Variant value)
Parameters
Type | Name | Description |
---|---|---|
System.String | expression | The expression. |
Variant | value | The value of currently printing object. |
Returns
Type | Description |
---|---|
System.Object | Returns the result of calculation. |
CalcExpressionAsync(String, Variant, CancellationToken)
Returns an expression value.
Declaration
public virtual async Task<object> CalcExpressionAsync(string expression, Variant value, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
System.String | expression | The expression. |
Variant | value | The value of currently printing object. |
System.Threading.CancellationToken | token | Cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | Returns the result of calculation. |
Clear()
Clears the inner state.
Declaration
public virtual void Clear()
Compile()
Compiles the report's script.
Declaration
public virtual void Compile()
CompileAsync(CancellationToken)
Compiles the report's script async way.
Declaration
public virtual async Task CompileAsync(CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
CreateAssemblyDescriptor(String)
Creates a new instance of assembly descriptor specific to this provider.
Declaration
public abstract AssemblyDescriptor CreateAssemblyDescriptor(string scriptText)
Parameters
Type | Name | Description |
---|---|---|
System.String | scriptText | Script text. |
Returns
Type | Description |
---|---|
AssemblyDescriptor | Assembly descriptor instance.. |
GenerateReportAssembly(String)
Generates the file (.cs or .vb) that contains the report source code.
Declaration
public virtual void GenerateReportAssembly(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file. |
InternalInit()
Initializes the report's fields.
Declaration
public virtual void InternalInit()
InvokeMethod(String, Object[])
Invokes the script method with given name.
Declaration
public virtual object InvokeMethod(string name, object[] parms)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the script method. |
System.Object[] | parms | The method parameters. |
Returns
Type | Description |
---|---|
System.Object | Returns the result of invokation. |
TryCalcExpression(String, Variant, out Object)
Tries to calculate an expression.
Declaration
protected virtual bool TryCalcExpression(string expression, Variant value, out object result)
Parameters
Type | Name | Description |
---|---|---|
System.String | expression | The expression to calc. |
Variant | value | The value parameter. |
System.Object | result | The calculation result. |
Returns
Type | Description |
---|---|
System.Boolean | true if the expression was calculated. |