V1
V1

TextBox

TextBox report control is a data bound input control which is used for entering and editing text-based information. It is the default data region that appears in each cell of a Table or Tablix report control and is automatically created when you drag a field from a dataset (data field) on the report.

Expressions for data fields

When you drag a field from a dataset on 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.

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.
Tablix data region, corner cell none Displays a blank cell. You can add a label or even use this area to embed other report control.
Tablix data region, column group cell =Fields!SalesAmount.Value Displays the value at the top of a new column for each row of data running to the right.
Tablix data region, row group cell =Fields!SalesAmount.Value Displays the value to the left of a new row for each row of data running down the page.
Tablix data region, body cell =Sum(Fields!SalesAmount.Value) Displays a summary of the sales amount for the intersection of the column and row.

You can select Expression… within many properties to open the Expression Editor. You can also access the Expression Editor from the context menu of the TextBox control.

Text Justify

The Text Justify property of a TextBox control provides you with justification options when you align the text within a control. You can choose from the following options.

  • Auto: Results in Standard MSWord like justification where space at the end of a line is spread across other words in that line. This is the default value.
  • Distribute: Spaces individual characters within a word, except for the last line.
  • DistributeAllLines: Spaces individual characters within words and also justifies the last line according to the length of others lines.

Multi Line

You can also display text within a control on multiple lines. With the TextBox control in edit mode, insert line breaks at the desired location using the 'Enter' key or 'Shift' + 'Enter' key to create multiline text. You can also insert line breaks in the Expression Editor through the Value property of the control.

Line Spacing and Character Spacing

In order to make your report output clearly visible during export or printing, you can increase the space between characters and between lines using Character Spacing and Line Spacing properties, respectively. In order to visualize line spacing, you must first have multiple lines in the TextBox control.

Shrink Text to Fit

You can use the Shrink To Fit property to reduce the size of the text so that it fits within the bounds of the control. The text shrinks at run time, so you can see the reduced font size when you preview, print or export the report. You can use other text formatting properties in combination with the Shrink To Fit property.

  • When both Can Grow and Shrink To Fit are set to True, the Can Grow property is ignored and only Shrink To Fit is applied to the report.
  • Shrink To Fit property does not work if the Writing Mode property is set to 'tb-rl' (top to bottom, right to left).
  • Common value with Page number (in data region or report header/footer) appears clipped in exported files (HTML and Excel) even when the Shrink To Fit property for the TextBox is set to True.

Condense Characters

The Min Condense Rate property allows users to shrink the width of the text so that it fits within the width of the control. With Min Condense Rate property,

  • the size of the text is compressed horizontally and all characters and character-spacing in the text shrink with the same ratio; while with Shrink To Fit property, both height and width of a text are compressed.

  • when a text is multi-line, the width of the text shrinks based on the longest line. If the text cannot fit the width of the control even after the width of the text is compressed with the minimum ratio, line breaks are inserted in the middle of the text depending on the setting of the Wrap Mode property.

The default value of the Min Condense Rate property is 100% and the available range is from 10 to 100 (only natural number). When the Min Condense Rate property is specified, the following properties are ignored:

  • Angle
  • Shrink To Fit
  • Vertical Align
  • Writing Mode