ActiveReports 9 > ActiveReports User Guide > Concepts > Section Report Concepts > Section Report Toolbox > RichTextBox |
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.
HTML Tags
The following HTML tags are supported in the RichTextBox control.
Tip: In order to show special characters in an HTML file loaded into the control, use the character entity reference (for example, è for è or & for &). |
Tag | Description | Attributes |
---|---|---|
<B> | Bold | none |
<I> | Italic | none |
<P> | Paragraph | align, style |
<STRONG> | Strong (looks like bold) | none |
<BIG> | Big | none |
<SMALL> | Small | none |
<PRE> | Preformatted | none |
<FONT> | Font | face, size, color, style (see notes for style attributes) |
<BODY> | The body tag | background, text, leftmargin |
<H1> - <H6> | Heading levels one through six | none |
<BR> | Line break | none |
<EM> | Emphasized (looks like Italics) | none |
<U> | Underlined | none |
<IMG> | Image | align, height, src, width |
<SUP> | Superscript | none |
<SUB> | Subscript | none |
<CENTER> | Center alignment | none |
<TABLE> | Table | align, border, cellpadding, cellspacing, height, style, width |
<TR> | Table row | align |
<TH> | Table head | none |
<TD> | Table datum | align, border, colspan, rowspan, width |
<LI> | List item | none (nested levels automatically use disc, then circle, then square bullets) |
<OL> | Ordered list | type |
<UL> | Unordered list | type |
<STRIKE> | Strike through | none |
Style Attribute Properties
The style attribute of <FONT>, <P>, and <TABLE> tags supports the following properties.
|
|
|
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.
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.