In ActiveReports, the RichTextBox control is used to display, insert and manipulate formatted text. It is different from the TextBox control in a number of ways. The most obvious is that it allows you to apply different formatting to different parts of its content.
You can also load an RTF file or an HTML file into the RichTextBox control at design time or at run time, and you can use it to create field merged reports with field placeholders that you replace with values at run time. You can add fields to the text you enter directly in the control by right-clicking and choosing Insert Fields and providing a field name.
For more information, see Load a File into a RichTextBox Control and Mail Merge with RichTextBox.
Important Properties
Property | Description |
---|---|
AutoReplaceFields | If True, any fields in the RTF control are replaced with fields from the data source. |
CanGrow | Determines whether ActiveReports should increase the height of the control based on its content. |
CanShrink | Determines whether ActiveReports should decrease the height of the field based on its value. |
MultiLine | Gets or sets a value that determines whether the RichTextBox prints multiple lines or a single line. |
DataField | Gets or sets the field name from the data source to bind to the control. |
Keyboard Shortcuts
In edit mode, you can use the following keyboard shortcuts.
Key Combination | Action |
---|---|
Enter | New line. |
Alt + Enter | Saves modifications and exits edit mode. |
Esc | Cancels modifications and exits edit mode. |
In the End User Designer, you can disable this feature in the EditModeEntering and EditModeExit events.
With the control selected on the report, in the Commands section at the bottom of the Properties window, you can click the Load file command to open the dialog. This allows you to select a file to load into the control at design time. Supported file types are as follows.
To load a file into the report at run time, use the Load method. For more information, see Load Method.
See the Supported XHTML Tags section in Formatted Text to learn about what HTML tags the RichTextBox control supports.
With the control selected on the report, in the Commands section at the bottom of the Properties window, you can click the Property dialog command to open the dialog.
General
Name: Enter a name for the RichTextBox that is unique within the report. This name is displayed in the Document Outline and in XML exports. You can only use underscore (_) as a special character in the Name field. Other special characters such as period (.), space ( ), forward slash (/), back slash (\), exclamation (!), and hyphen (-) are not supported.
Tag: Enter a string that you want to persist with the control. If you access this property in code, it is an object, but in the Properties window or Property dialog, it is a string.
Visible: Clear this check box to hide the control.
DataField: Select a field from the data source to bind to the control.
Max length: Enter the maximum number of characters to display in the control. If you do not specify a value, it displays an unlimited number of characters.
AutoReplaceFields: Select this check box to have ActiveReports replace any fields in the control with values from the data source.
Appearance
Background Color: Select a color to use for the background of the control.
Format
Can increase to accommodate contents: Select this check box to set CanGrow to True.
Can decrease to accommodate contents: Select this check box to set CanShrink to True.
Multiline: Select this check box to allow the control to display multiple lines of text.