property G2antt.Template as String
Specifies the control's template.

TypeDescription
String A string expression that indicates the control's template.

The control's template uses the X-Script language to initialize the control's content. You configure this through the Template property page of the control, which lets you edit the control's Template property. The Template property lets you execute code by passing it a string of instructions (the "template string"). The ExecuteTemplate property runs a template script and returns the result.

Most of our UI components include a Template page you can access in design mode. Regardless of which programming language you're using, this WYSIWYG Template editor lets you preview the component's features quickly.

The Template page lets you set up the control's look and feel visually, using the simple but powerful x-script language. The control preview appears on the left side of the page, and an editor for writing initialization code appears on the right. As you type new instructions, the control's appearance updates immediately. When you click Apply, the script is saved with the container and will run automatically whenever the control initializes at runtime. Any component with a WYSIWYG Template page also exposes a Template property, which runs code supplied as a string (the template string).

A template (x-script) consists of lines of instructions. Instructions are separated by newline characters ("\n\r") or by a semicolon (";"). The template string can contain any number of instructions, and each instruction can be a property call, a method call, or an assignment statement. The template string can also contain comments, which start with a single quote (') and continue to the end of the line.

The BNF notation for the x-script language is as follows:

<script> ::= <statement> | <statement> <separator> <script>
<separator> ::= "\n\r" | ";"

<statement> ::= "Dim" <variables> | <expression> "=" <value> | <expression>
<expression> ::= <identifier> <suffix> | <expression> "{" <script> "}"
<suffix> ::= <empty> | "." <identifier> <suffix> | "(" <arguments> ")" <suffix>

<variables> ::= <identifier> | <identifier> "," <variables>
<arguments> ::= <empty> | <value> | <value> "," <arguments>
<value> ::= <identifier> | "True" | "False" | <number> | <date> | <string>

Each x-script line can take one of the following forms:

X-script also supports the following literal (constant) expressions:

X-script also provides these general-purpose functions: