The TextBox report item is used to display text on a report.
The TextBox can display literal text for titles, descriptions, and labels, or dynamic text based on expressions. Every cell in a Table or CrossTab also contains a TextBox, which can be formatted in the same way as the standalone TextBoxes in the report. The expressions in a TextBox can contain literal text, point to a database field, or calculate data.
To control the TextBox layout and its dependency on other report items, use a Panel report item.
To format separate chunks of text (different words) or insert HTML-formatted text into a report, use the HtmlTextBox report item.
The following image shows two TextBox report items.
By default, the TextBox items have their size set.
- To allow a TextBox to expand vertically based on its content, set the
True, which is the default value.
- To allow a TextBox to shrink based on its content, set the
True. By default,
CanShrinkis set to
False. The TextBox will always grow to accommodate the first line of the text even when
To change the text orientation in a TextBox item, use the
Angle property. This approach enables you to create more readable reports, supports locale-specific text orientation, fits more columns on a printed report that has a fixed page size, and creates reports with a better graphical appeal.
The layout of the tilted text starts from the corner of the client item rectangle and fits the text until finished. This behavior produces short initial text lines which can be avoided, if desired, by adding some empty lines at the beginning of the text or expression:
this.textBox1.Value = "= \"\r\n\r\n\" + Fields.MyDataColumn";
Me.textBox1.Value = "= """ & vbCr & vbLf & vbCr & vbLf & """ + Fields.MyDataColumn"
The item grows vertically to accommodate a full tilted line from the left to the right edge which may produce a significant growth of the item especially for angles nearing 90 degrees. To avoid this behavior, set the
CanGrow property to
For angles in the 90-270 degree range, the item will grow until the whole text is fitted on a single line. To control this behavior, use the
For busy reports that will need to break the item into two pages, reconsider using tilted text as split tilted text is hardly readable.
The in-place editor for the TextBox report item allows you to quickly enter text directly into the designer.
To activate the in-place editor:
- Double-click the TextBox report item or select the report item and press
F2. As a result, the in-place editor is activated.
- To create a new line, press
- To accept all changes, press
Enteror move the focus away from the TextBox.
- To discard all changes, press
The following image shows a TextBox with an activated in-place editor.
For more information about how to use the Expression editor, refer to the article on the Edit Expression dialog. Note that when pressing the
Enter key inserts a new line in the expression. To insert a new line in the string resulting from the evaluated expression, enclose the new line within double quotes (
The TextBox report item supports embedded expressions to provide a mail merge functionality. Embedded expressions enable you to get and insert data-driven information directly into the TextBox report item to produce customized reports and mail merging.
Before you apply a TextBox format, consider the following:
- By default, numbers are formatted to reflect the cultural settings on the client computer. To specify how numbers are displayed and provide consistent formatting regardless of where the person who is viewing the report is located, use formatting strings.
- The formats provided on the Number page are a subset of the .NET Framework standard numeric format strings. To format a number or a date by using a custom format that is not shown in the dialog box, use any number or date .NET Framework format strings. For more information about custom format strings, refer to the MSDN Formatting Types topic.
- If you specify a custom format string, it will prevail over the default settings that are culture-specific. For example, if you set a custom format string of
#,###to render 1234 as
1,234, users in different parts of the world may interpret it in different ways. Before specifying a custom format, consider how the chosen format will affect users of different cultures viewing the report.
- If you specify an invalid format string, it will override the actual
For more information, refer to the article about the Format Builder dialog.