Label¶
Label Overview¶
The Label control is used to showcase plain text within a report. Simply drag the Label item from the Toolbox and drop it onto the desired location within the report to add a Label control.
To enter the desired static text, double-click on the label to open its in-place editor.
To submit text changes and exit the label's in-place editing mode, simply press CTRL+Enter.
Bind to Data¶
Display Field Values¶
To bind the label's Text property to a data field from the report's data source, navigate to the Properties panel. Expand the Label Tasks category, and click on the f icon next to the Text property. Next, in the Expression Editor, select a data field or create a binding expression. You can also use the f icon that pops up when you select a label.
The Expression Editor allows you to create complex binding expressions involving two or more data fields.
Another option is to create a new label bound to a numeric or text field by simply dragging and dropping the field from the Field List.
The Process Duplicates Mode, Process Duplicates Target and Process Null Values options enable you to hide a control when a duplicated or null value appears in an assigned data source.
Additionally, you have the option to utilize the Text Format String property to define the format of output values.
Clicking the ellipsis button opens the FormatString editor:
Display Summaries¶
To display the result of a summary function in a label, define a data range in the Running property and select the desired summary function in the Expression Editor.
The ellipsis button invokes the Expression Editor:
Adjust the Label Size and Content¶
Static Content¶
To resize a label to fit its static text, you can utilize the Fit Bounds To Text command found in the label's context menu.
Enabling the Word Wrap option will display the control content across multiple lines, reducing the control's height and adjusting its width to accommodate the content.
When the Word Wrap option is turned off and the control's content is only partially visible, using the command adjusts the control's size to fully display this content.
The outcome of this command is also influenced by the control's Text Alignment and Right To Left settings.
To adjust the control's font size to fit its area, utilize the Fit Text To Bounds button. Additionally, the Word Wrap option determines whether the text can span multiple lines or should remain on a single line.
The following scenarios restrict access to these commands:
- When a label's text is an empty string.
- When a label's text is bound to data.
- When a label's Angle property is specified.
Data-Bound Labels¶
In Print Preview mode, the Can Grow and Can Shrink properties enable you to expand or contract the control's height based on its content.
The Auto Width property determines whether a data-bound label's width adjusts automatically to fit its content.
Alternatively, the Text Fit Mode property adjusts a control's font size to fit its boundaries in Print Preview. However, note that this property is not accessible if the Can Grow, Can Shrink, or Auto Width option is enabled.
Interactivity¶
To enable editing of a label's content in Print Preview mode, set the Enabled option in the Edit Options category to Yes.
Clicking on this label within a previewed document will bring up the relevant editor.
Utilize the label's Interactive Sorting option to enable clicking on it in Print Preview for sorting report data. Configure the Target Band property to the Group Header or Detail band, and specify the data field in the Field Name property
Markup Text¶
To format the label's text using markup tags, enable the Allow Markup Text property.
Label supports the following tags:
Tag | End Tag | Description |
---|---|---|
< br> | Inserts a single line break. Enable the WordWrap property to use this tag. | |
< nbsp> | - | Inserts a space. |
< /color> | Specifies the text color. | |
< /backcolor> | Specifies the background color. | |
< /size> | Specifies the font size. | |
< b> | < /b> | Defines bold text. |
< i> | < /i> | Defines italic text. |
< s> | < /s> | Defines strikethrough text. |
< u> | < /u> | Defines underlined text. |
< image=value**> ** |
- | Inserts an image from the report's named image collection. Supports both raster images and SVG images. Use the report's Image Resources property to provide images and reference them by their Id. The image tag's size attribute sets the image display pixel size. If the specified width/height exceeds the label's width/height, it is reduced to display the entire image. Specify the size attribute after the tag's value followed by the ";" character. |
< href=value> |
< /href> | Displays a hyperlink. The value string specifies the hyperlink source, and the string between the opening and closing tags is the text to display. |
When a report is exported to XLS or XLSX, the following rich-text content is converted from labels into Excel-native rich-text content:
Text format | < b>, < i>, < u>, < s> |
Line break | < br> |
Non-breaking space | < nbsp> |
Font | < font=[font name]> |
Font size | < size=[font size]> |
Foreground color | < color=[color]> |