ActiveReports 18 .NET Edition
Report Authors: Designer Components / Report Controls / Page/RDLX Report / FormattedText
In This Topic
    FormattedText
    In This Topic

    The FormattedText report control can perform mail merge operations, plus it displays richly formatted text in HTML. To format text in the FormattedText report control, enter HTML code into the Html property.

    Note: All text written in the Html property must be enclosed in the <body></body> tags.

    The design-time editor displays the HTML text with the applied formatting, so you can view the text just as it will be displayed on the preview.

    Important Properties

    By clicking on the FormattedText control, you can set its properties in the Properties window.

    Property Description
    AccessibleDescription Enter the alternative description of the control for use by accessibility client application. The property on exporting the report adds the ‘alternative text’ in PDF and ‘alt’ attribute in HTML.
    EncodeMailMergeFields Select whether you want to encode mail merge fields or not.
    Html Enter HTML code to format text.
    MailMergeFields Add new mail merge fields to the FormattedText.
    Size Set the Width and Height of the FormattedText control.

    FormattedText Dialog Properties

    You can set the FormattedText properties in the FormattedText dialog. To open it, with the FormattedText selected on the report, under the Properties window, click the Property dialog link.

    Name: Enter a name for the FormattedText that is unique within the report. This name can be called in code. You can only use underscore (_) as a special character in the Name field. Other special characters such as period (.), space ( ), forward slash (/), backslash (\), exclamation (!), and hyphen (-) are not supported.

    Tooltip: A textual label for the report item used to include TITLE or ALT attributes in HTML reports.

    Initial visibility

    • Visible: The FormattedText is visible when the report runs.
    • Hidden: The FormattedText is hidden when the report runs.
    • Expression: Use an expression with a Boolean result to decide whether the FormattedText is visible. True for hidden, false for visible.

    Visibility can be toggled by another report item: Select this check box to display a toggle image next to another report control. This enables the drop-down box below where you can specify the TextBox control that toggles the visibility of the FormattedText. The user can click the toggle item to show or hide this FormattedText.

    Document map label: Enter an expression to use as a label to represent this item in the table of contents (document map).

    Bookmark ID: Enter an expression to use as a locator for this FormattedText. You will then be able to provide a bookmark link to this item from another report control using a Jump to bookmark action.

    Background

    Color: Select a color to use for the background of the FormattedText.

    Image: Add an image to use for the background of the FormattedText.

    Border

    Style: Select a style for the border.

    Width: Enter a value in points to set the width of the border.

    Color: Select a color to use for the border, or select the <Expression...> option to open the Expression Editor and create an expression that evaluates to a .NET color.

    Element Name: Enter a name to be used in the XML output for this FormattedText report control.

    Output: Choose Auto, Yes, No, or Contents Only to decide whether to include this FormattedText in the XML output. Choosing Auto exports the contents of the FormattedText report control.

    Check on the Encode Mail Merge Fields option to encode mail merge fields.

    Click the plus sign button to add a new mail merge field to the FormattedText, and delete them using the X button.

    Field: Enter a name for the field that is unique within the report. This is used in the Html property inside <%FieldName%> tags to display the field in the formatted text.

    Value: Enter an expression to pull data into the control for mail merge operations.

    Here is a very simple example of HTML code that you can use to add mail merge fields to formatted text. This example assumes that you have added two mail merge fields named Field1 and Field2.

    Paste this code in the Html property of the FormattedText control.
    Copy Code
    <body><p>This is <%Field1/%> and this is <%Field2/%>.</p></body>
    

    Supported HTML Tags and Attributes

    The FormattedText control supports almost all HTML tags and attributes from the XHTML 1.1 specification (see https://www.w3.org/TR/xhtml11/ for details) with some extensions to partially support the HTML5 specification (see https://www.w3.org/TR/2011/WD-html5-20110405/ for details). Additionally, the FormattedText control supports many (but not all) CSS styles.

    For example, the FormattedText control supports these HTML tags and attributes. If you use valid HTML tags that are not in the list below, ActiveReports ignores them.

    Caution: To enter & in the HTML property, you need to use &amp;.

    Supported HTML Tags and Attributes

    HTML Tags Attributes Description
    <%MergeFieldName%> Inserts a mail merge field.
    <!-- -- > Defines a comment
    <!DOCTYPE> Defines the document type
    <a> Defines an anchor
    <abbr> Defines an abbreviation
    <acronym> Defines an acronym
    <address> Defines an address element
    <b> Defines bold text
    <base /> Defines a base URL for all the links in a page
    <bdo> Defines the direction of text display
    <big> Defines big text
    <blockquote> Defines a long quotation
    <body> Defines the body element (Required)
    <br /> Inserts a single line break
    <caption> Defines a table caption
    <center> Defines centered text
    <cite> Defines a citation
    <code> Defines computer code text
    <col> Defines attributes for table columns
    <dd> Defines a definition description
    <del> Defines deleted text
    <dir> Defines a directory list
    <div> style Defines a section in a document
    <dfn> Defines a definition term
    <dl> Defines a definition list
    <dt> Defines a definition term
    <em> Defines emphasized text
    <h1> to <h6> align Defines header 1 to header 6
    <head> Defines information about the document
    <hr /> Defines a horizontal rule
    <html> Defines an html document
    <i> Defines italic text
    <img /> align
    src
    height
    width

    Defines an image. Use src attribute to define path of the image, for example:
    <img src="https://.../images/image.png"/>

    To refer an image embedded within the report, specify the image name:
    <img src="image_name"/>

    <ins> Defines inserted text
    <kbd> Defines keyboard text
    <li> Defines a list item
    <link> href Defines a link
    <map> Defines an image map
    <menu> Defines a menu list
    <ol>

    type
    align

    Defines an ordered list
    <p> Defines a paragraph
    <pre> Defines preformatted text
    <q> Defines a short quotation
    <s> Defines strikethrough text
    <samp> Defines sample computer code
    <small> Defines small text
    <span> Defines a section in a document
    <strike> Defines strikethrough text
    <strong> Defines strong text
    <style> Defines a style definition
    <sub> Defines subscripted text
    <sup> Defines superscripted text
    <table>

    align
    bgcolor
    border
    bordercolor
    cellpadding
    cellspacing
    width

    Defines a table
    <tbody>

     

    Defines a table body.
    <td> align
    bgcolor
    colspan
    height
    nowrap
    rowspan
    valign
    width
    Defines a table cell
    <tfoot> Defines a table footer
    <th> abbr
    align
    axis
    bgcolor
    colspan
    headers
    height
    nowrap
    rowspan
    scope
    sorted
    valign
    width
    Defines a table header
    <thead> Defines a table header. It is used along with <tbody> and <tfoot>.
    <tr> align
    bgcolor
    bordercolor
    height
    valign
    Defines a table row
    <tt> Defines teletype text
    <u> Defines underlined text
    <ul> Defines an unordered list
    See Also