ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Working with C1PrintDocument > Expressions, Scripts, Tags > Tags/expressions syntax

Tags/expressions syntax

You can change the square brackets used to include tags or scripts in text to arbitrary strings, if desired, via the document's TagOpenParen and TagCloseParen properties. This may be a good idea if your document contains a lot of square brackets – by default, they will all trigger expression parsing which can consume a lot of resources even if not affecting the result visually. So, for instance this:

      Visual Basic

doc.TagOpenParen = "@@@["

doc.TagCloseParen = "@@@]"

      C#

doc.TagOpenParen = "@@@[";

doc.TagCloseParen = "@@@]";

will ensure that only strings surrounded by "@@@[" and "@@@]" are interpreted as expressions.

The expression brackets can also be escaped by preceding them with the backslash symbol, for instance this code:

      Visual Basic

Dim doc As New C1PrintDocument()

doc.Body.Children.Add(new RenderText("2 + 2 = \[2+2\]"))

      C#

C1PrintDocument doc = new C1PrintDocument();

doc.Body.Children.Add(new RenderText("2 + 2 = \[2+2\]"));

will produce the following text in the generated document:

2 + 2 = [2+2]

because the brackets were escaped.

The property TagEscapeString on the document can be used to change the escape symbol to an arbitrary string.


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