method G2antt.ExecuteTemplate (Template as String)
Executes a template and returns the result.

TypeDescription
Template as String A Template string being executed
ReturnDescription
VariantA Variant expression that indicates the result after executing the Template.

The ExecuteTemplate method executes a template string (x-script code) and returns the value produced by the template. The returned value is the result of the last expression or statement executed by the template. Use the Template property to execute a template string without returning a result. For more details about x-script, see the control's Template property.

For instance,the following VB sample code executes a template string that returns the control's BackColor property:

Debug.Print Control.ExecuteTemplate("BackColor)")

where Control is a reference to the control. The ExecuteTemplate method returns the value of the control's BackColor property, which is printed to the debug output window.

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).