Report Manager ← Back to site

Common properties for text components

Component Reference

Common properties for text components

Summary

This properties applies to components with text properties like TRpLabel, TRpExpression and TRpChart

Name Internal Name Type Description
H.Alignment Alignment H.TextAlign Horizontal alignment for the text inside the box defined by the component. The text can be aligned Left (also None), Right and Center. Bidi property can alter the meaning of this property. Internally stored as an integer.
V.Alignment VAlignment V.TextAlign Vertical alignment for the text inside the box defined by the component. The text can be aligned top (also None), bottom and center. Internally stored as an integer.
WFont Name WFontName WideString Font name (Type face family name) for Microsoft Windows operating systems, this property will be used when the engine runs in this operating system and the driver uses system fonts, usually GDI (and Qt in legacy builds).
LFont Name LFontName WideString Font name (Type face family name) for Linux operating systems, this property will be used when the engine runs in this operating system and the driver uses system fonts, usually using Qt printing or display system.
PDF Font Type1Font TRpType1Font Font when the result is a PDF file, the generation of pdf files does not requires an X Server running in Linux, but can use only one of the standard PDF fonts in current implementation.
Font size FontSize Integer Font size in standard points unit, that is 72 points=1 inches
Font step FontStep TRpSelectFontStep Font step for dot matrix output and text output with a printer driver selected, the engine will select the nearest size
Font Color FontColor Color Font color, internally stored as a quad byte 0BGR integer
Font Style FontStyle Integer Combination of a set of possible effects for the font: bold, italic, underline and strikeout, all the styles are compatible. Internally stored as an Integer.
Bidi BidiModes BidiMode

If enabled, the engine will use DirectWrite in Windows and the stack Fontconfig-ICU-HarfBuzz in Linux. This allow to render complex shaping texts like arabic

Name Description
No Bidi No Bidi support enabled, no complex shaping will be done
Partial Bidi, complex text support enabled. Bidi enabled
Full Bidi Bidi enabled

Bidi support and complex-script shaping are implemented on Windows (DirectWrite) and on Linux (ICU and HarfBuzz), and in PDF export.

Back Color BackColor Color Background color for the printed text, if Transparent property is set to false
Transparent Transparent Boolean If false a background color (Back Color) will be used for the text
Cut Text CutText Boolean If true, the text will be clipped to the defined box, else the text will expand outside the box, if word wrap is true, the width of the box will be preserved.
Word wrap Wordwrap Boolean Will break the sentences in more lines if the lines does not fit in current box width.
Single line SingleLine Boolean Will force printing of text in a single line even if it contains line feeds.
F.Rotation FontRotation Angle Rotation angle in degrees for the text. Rotation in reverse clock wise, internally stored as an integer in degrees*10 scale.
Is Html IsHtml Boolean When set to true, the text content is interpreted as HTML markup. The engine parses a subset of HTML tags to apply inline formatting such as bold, italic, underline, strikeout, font family, font size and text color within a single text element. Additionally, when IsHtml is enabled, double-brace expression substitution is available (see below). Default value is false.

HTML Mode Details (IsHtml = true)

When IsHtml is enabled, the text content is parsed as HTML. The engine supports a subset of HTML tags and attributes designed for inline rich text formatting. The base font properties (WFont Name, Font Size, Font Color, Font Style) of the component serve as defaults; HTML tags override them for specific text runs.

Supported HTML Tags

Tag Description Example
<b>, <strong> Bold text <b>bold text</b>
<i>, <em> Italic text <i>italic text</i>
<u> Underlined text <u>underlined</u>
<s>, <del>, <strike> Strikethrough text <s>deleted</s>
<br> Line break Line 1<br>Line 2
<span> Inline formatting with CSS style attribute. Supports font-family, font-size (in pt or px) and color properties. <span style="font-family:Arial; font-size:14pt; color:#FF0000">text</span>
<font> Legacy font tag. Supports face attribute for font family and size attribute for font size (HTML legacy sizes 1-7 are mapped to point sizes: 1=8pt, 2=10pt, 3=12pt, 4=14pt, 5=18pt, 6=24pt, 7=36pt). <font face="Courier New" size="4">text</font>

Supported CSS Style Properties (for <span> tags)

Property Description Example
font-family Sets the font family for the text run. font-family: Arial
font-size Sets the font size in points (pt) or pixels (px). font-size: 14pt
color Sets the text color. Accepts hex values (#RRGGBB or #RGB) and named colors: red, blue, green, black, white, yellow, orange, purple, gray, grey. color: #FF0000 or color: red

Supported HTML Entities

Entity Character
&nbsp; Non-breaking space
&lt; < (less than)
&gt; > (greater than)
&amp; & (ampersand)
&quot; " (double quote)
&#39; ' (single quote / apostrophe)

Tag Nesting

Tags can be nested to combine effects. For example:

<b><i>bold and italic</i></b>

<span style="color:red">Red <b>bold red</b> text</span>

The <span> and <font> tags use a stack-based model: when a closing tag is encountered, the formatting reverts to the state before the corresponding opening tag. This allows proper nesting of font family, size and color overrides.

Expression Substitution with Double Braces

When IsHtml is enabled, the engine supports expression substitution using double-brace placeholders: {{expression}}. Before the HTML is parsed, the engine scans the text for all occurrences of {{...}} and replaces them with the evaluated result of the enclosed expression.

The expressions use the same evaluator as TRpExpression components, so any valid report expression can be used inside the braces. This allows mixing static HTML formatting with dynamic data values.

Example:

Dear <b>{{CUSTOMERS.NAME}}</b>, your balance is <span style="color:red">{{FormatStr('#,##0.00',CUSTOMERS.BALANCE)}}</span>

In this example, {{CUSTOMERS.NAME}} is replaced with the actual customer name value and {{FormatStr('#,##0.00',CUSTOMERS.BALANCE)}} is replaced with the formatted balance. The HTML formatting is then applied to the resulting text.

If an expression cannot be evaluated (for example, due to a syntax error), the original placeholder text including the double braces is preserved in the output.

Developer info

Internal component name TRpGenTextComponent
Parent class TRpCommonPosComponent
Unit name rpprintitem.pas

See also Report components common properties.