Adding Code to Text Templates
You can use Visual Basic or Visual C# code to control how the text that results from processing the template is generated based on input data. Code blocks fall into three categories: statements, expressions, and class features.
In This Section
- Text Syntax (Domain-Specific Languages)
-
Explains the role of text blocks in text templates.
- Statement Syntax
-
Explains the role of statements in text templates and shows the syntax for using them.
- Expression Syntax (Domain-Specific Languages)
-
Explains the role of expressions in text templates and shows the syntax for using them.
- Class Feature Syntax
-
Explains the role of class features in text templates and shows the syntax for using them.
- How to: Add a Statement to Text Templates
-
Lists the steps to add a statement to a text template and gives an example.
- How to: Add an Expression to Text Templates
-
Lists the steps to add an expression to a text template and gives an example.
- How to: Add Helper Functions to Text Templates
-
Lists the steps to add a class feature to a text template and gives an example.
- How to: Generate Errors and Warnings from Text Templates
-
Lists the steps to generate errors and warnings from text templates using the Error and Warning methods.
- How to: Append Text to the Generated Text
-
Lists the steps to append text to the generated text using the Write and WriteLine methods.