The Textbox is the most commonly used report control that displays data. By default, the TextBox appears in each cell of a Table or Matrix data region. Also, the TextBox is what is created when you drag a field from the Data Explorer onto the report.
In the Value property of the TextBox, you can enter static text or an expression. An expression can display fields from a database, calculate a value, or visually display data.
Tip: You can enter text directly into the TextBox on the design surface of the report by double-clicking inside it. |
In the Properties Window are a number of properties that you can use to control the appearance and behavior of the TextBox. For example, you can set the Action property to have the viewer jump to a bookmark within the report, another report, or a URL when a user clicks the TextBox at run time. The DataElement properties allow you to control how and whether the TextBox displays in XML exports.
By default, in CPL reports, the TextBox can grow vertically to accommodate the data it displays, and it cannot shrink smaller than it appears at design time. To change this behavior, set the CanShrink and CanGrow properties in the Properties grid. (These properties are not available in FPL reports.)
Data Fields
When you drag a field from a dataset in the Data Explorer and drop it onto the report surface, a TextBox report control with an expression is automatically created. The type of expression that is created depends upon the context where you drop the field. The following table describes the various contexts and expressions created if you drag a field named SalesAmount onto the report.
Expressions created for fields in different contexts
Note: The expression created is different for a field with a string or unknown data type. In these cases, the First aggregate is used in place of the Sum aggregate in the expressions below. At run time, the first value found within the scope is displayed instead of a summary. |
Context | Expression | Run-Time Behavior |
---|---|---|
Directly on the report surface | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the entire dataset. |
List data region | =Fields!SalesAmount.Value | Displays a value for each row of data, in a list running down the page. |
BandedList data region, header or footer band | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the dataset associated with the BandedList. |
BandedList data region, detail band | =Fields!SalesAmount.Value | Displays a value for each row of data, in a list running down the page. |
BandedList data region, group header or footer band | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the grouping. |
Table data region, header or footer row | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the dataset associated with the Table. |
Table data region, detail row | =Fields!SalesAmount.Value | Displays a value for each row of data, in a list running down the page. |
Table data region, group header or footer row | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the grouping. |
Matrix data region, corner cell | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the dataset associated with the Matrix. |
Matrix data region, column header cell | =Fields!SalesAmount.Value | Displays the value at the top of a new column for each row of data running to the right. |
Matrix data region, row header cell | =Fields!SalesAmount.Value | Displays the value to the left of a new row for each row of data running down the page. |
Matrix data region, detail cell | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the intersection of the column and row. |
Textbox Dialog
Properties for the Textbox are available in the Textbox dialog. To open it, with the Textbox control selected on the report, under the Properties Window, click the Property dialog link.
The Textbox dialog lets you set properties on the report control with the following pages.
Note: You can select <Expression...> within many of these properties to open the Expression Editor. |
Name: Enter a name for the textbox that is unique within the report. This name is displayed in the Document Outline and in XML exports.
Tooltip: Enter the value or expression you want to appear when a user hovers the cursor over the textbox in the viewer at run time.
Note: You must select Print Preview mode in order to see this property working in the viewer.
Value: Enter an expression or a static label, or choose a field expression from the drop-down list.
Hide duplicates: This option is disabled unless the TextBox is within a data region.
Data region: Enter or select a data grouping in which to hide repeated values.
Note: When the group or dataset breaks to a new page, the first instance of the repeated value is printed. |
Initial visibility allows you to select from the following options:
- Visible: The textbox is visible when the report runs.
- Hidden: The textbox is hidden when the report runs.
- Expression: Use an expression with a Boolean result to decide whether the textbox is visible. For example, on a "Free Shipping" textbox, you could use the expression to see whether the ShippingCountry is international. A value of True hides the textbox, False shows it.
Visibility can be toggled by another report control: If you select this check box, it enables the drop-down box where you can specify the report control that users can click to toggle the visibility of the textbox.
Initial appearance of the toggle image: allows you to select from the following options:
- Expanded: The toggle image shows as a minus sign, and all instances of this textbox are visible.
- Collapsed: The toggle image shows as a plus sign, and all instances of this textbox are hidden.
- Expression: Use an expression with a Boolean result to decide whether the toggle image is expanded. A value of True expands the toggle image, False collapses it.
Action
Select one of the following actions to perform when a user clicks on the textbox.
None: The default behavior is to do nothing when a user clicks the textbox at run time.
Jump to report: For drill-through reporting, select this option and provide the name of a local report, the relative path of a report in another folder, or the full path of a report on another server.
Parameters: Supply parameters to the targeted report by entering the Name of each parameter, the Value to send to the targeted report, or whether to Omit the parameter. Note that parameter names you supply must exactly match parameters in the target report. You can remove or change the order of parameters using the X and arrow buttons.
Jump to bookmark: Select this option and provide a valid Bookmark ID to allow the user to jump to the report control with that Bookmark ID.
Jump to URL: Select this option and provide a valid URL to create a hyperlink to a Web page.
Document map label: Enter an expression to use as a label to represent this item in the table of contents (document map).
Bookmark ID: Enter an expression to use as a locator for this textbox. You will then be able to provide a bookmark link to this item from another report control using a Jump to bookmark action.
Border
Style: Select a style for the border.
Width: Enter a value in points to set the width of the border.
Color: Select a color to use for the border, or select the <Expression...> option to open the Expression Editor and create an expression that evaluates to a .NET color.
Background
Color: Select a color to use for the background of the textbox.
Image: Enter an image to use for the background of the textbox.
Note: The Background Color and Background Image properties allow you to choose the <Data Visualizer...> option as well to launch the dialog that let you build a data visualization expression. |
Family: Select a font family name or a theme font.
Size: Choose the size in points for the font or use a theme.
Style: Choose Normal or Italic or select a theme.
Weight: Choose from Lighter, Thin, ExtraLight, Light, Normal, Medium, SemiBold, Bold, ExtraBold, Heavy, or Bolder.
Color: Choose a color to use for the text.
Decoration: Choose from None, Underline, Overline, or LineThrough.
Format code: Select one of the common numeric formats provided or use a custom .NET formatting code to format dates or numbers. For more information, see MSDN's Formatting Types topic.
Line Spacing: This property sets the space between lines of text.
Line Height: This property sets the height of lines of text with leading and ascending space.
Note: This property only affects HTML output. |
Character Spacing: This property sets the space between characters.
Textbox height
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.
Can shrink text to fit fixed size control: Select this check box to set ShrinkToFit to True.
Text direction and writing mode
Direction: Choose LTR for left to right, or RTL for right to left.
Mode: Choose lr-tb for left right top bottom (normal horizontal text) or tb-rl for top bottom right left (vertical text on its side).
Angle: Enter the number of degrees to rotate the text in a counter-clockwise direction. Enter a negative number to rotate the text in a clockwise direction.
Vertical alignment: Choose Top, Middle, Bottom, or the <Expression...> option.
Horizontal alignment: Choose General, Left, Center, Right, Justify, or the <Expression...> option.
Justify method: Set Horizontal alignment to Justify to enable this property. Choose Auto, Distribute, DistributeAllLines, or the <Expression...> option.
Wrap mode: Choose NoWrap, WordWrap, or CharWrap.
Amount of space to leave around report control
- Top padding: Set the top padding in points.
- Left padding: Set the left padding in points.
- Right padding: Set the right padding in points.
- Bottom padding: Set the bottom padding in points.
Select the checkbox next to Add an interactive sort action to this textbox to enable the following controls which allow end users to sort the report data in the viewer.
Sort expression: Enter an expression to use for determining the data to sort.
Data region or group to sort: Select the grouping level or data region within the report to sort. The default value is Current scope, but you may also elect to choose an alternate data region or grouping.
Evaluate sort expression in this scope: Select the grouping level within the report on which to evaluate an aggregate sorting expression. The default value is Current scope, but you may also elect to choose an alternate data region or grouping.
Element Name: Enter a name to be used in the XML output for this textbox.
Output: Choose Auto, Yes, or No to decide whether to include this textbox in the XML output. Auto exports the contents of the textbox only when the value is not a constant.
Render as: Choose Auto, Element, or Attribute to decide whether to render textboxes as Attributes or Elements in the exported XML file. Auto uses the report's setting for this property.
Attribute example: <table1 textbox3="Report created on: 7/26/2005 1:13:00 PM">
Element example: <table1> <textbox3>Report created on: 7/26/2005 1:13:28 PM</textbox3>