ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Working with C1PrintDocument > Expressions, Scripts, Tags > Scripting/Expression Language

Scripting/Expression Language

The language used in expressions is determined by the value of the property C1PrintDocument.ScriptingOptions.Language. That property can have one of two possible values:

      VB. This is the default value, and indicates that the standard VB.NET will be used as the scripting language.

      C1Report. This value indicates that the C1Report scripting language will be used. While that language is similar to VB, there are subtle differences. This option is primarily provided for backwards compatibility.

      CSharp. This value  indicates that the standard C# will be used as the scripting language.

If VB is used as the expression language, when the document is generated a separate assembly is built internally for each expression containing a single class derived from ScriptExpressionBase. This class contains the protected properties that can be used in the expression. The expression itself is implemented as a function of that class.

For example:

      Visual Basic

Dim doc As New C1PrintDocument()

doc.ScriptingOptions.Language = ScriptLanguageEnum.CSharp

Dim rt As New RenderText("[PageNo == 1 ? ""First"" : ""Not first""]")

doc.Body.Children.Add(rt)

      C#

C1PrintDocument doc = new C1PrintDocument();

doc.ScriptingOptions.Language = ScriptLanguageEnum.CSharp;

RenderText rt = new RenderText("[PageNo == 1 ? \"First\" : \"Not first\"]");

doc.Body.Children.Add(rt);


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.