Reports for WinForms | ComponentOne
Working with C1PrintDocument / Expressions, Scripts, Tags / Tags/expressions syntax
In This Topic
    Tags/expressions syntax
    In This Topic

    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:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    doc.TagOpenParen = "@@@["
    doc.TagCloseParen = "@@@]"
    

    To write code in C#

    C#
    Copy Code
    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:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Dim doc As New C1PrintDocument()
    doc.Body.Children.Add(new RenderText("2 + 2 = \[2+2\]"))
    

    To write code in C#

    C#
    Copy Code
    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.