Reports for WinForms | ComponentOne
Working with C1PrintDocument / Styles / Calculated Style Properties
In This Topic
    Calculated Style Properties
    In This Topic

    In the 2009 v3 release of Reports for WinForms, support was added for calculated style properties. For each style property, a matching string property was been added with the same name with "Expr" appended. For example, the BackColorExpr and TextColorExpr properties are matched to the BackColor and TextColor properties, and so on for all properties.

    Sub-properties of complex properties (such as ImageAlign, Borders, and so on.) also have matching expression sub-properties. For example, the LeftExpr property is matched to Left property and so on.

    Style Expressions

    The following objects can be used in style expressions:

    Converted Types

    Page References

    The following is an important note related to page references. Style expressions may reference the current page, for example:

    ro.Style.BackColor = "iif(PageCount < 3, Color.Red, Color.Blue)";
    

    Such expressions cannot be calculated when the document is generated. Thus, during generation such expressions are ignored (default values are used), and the values are only calculated when the actual page that contains the object is being rendered (for example, for drawing in the preview, exporting and so on).

    As the result, style expressions that depend on pagination AND would affect the layout of the document may yield unexpected and undesirable results. For example, if the following expression is used for font size:

    ro.Style.FontSize = "iif(PageCount < 3, 20, 30)";
    

    The above expression would be ignored during generation, as the result the rendered text will most probably be too large for the calculated object's size and clipping will occur.