TextBoxFormat Class
Represents a set of formatting properties that can be applied to a TextBox.
- Inheritance:
- System.ObjectTextBoxFormat
Properties
AutoFit
Gets or sets the text auto-fitting setting.
Default value is None.
This property is not applicable on a TextBox within a TableCell.
Property Value
The text auto-fitting setting.
AutoFitShrinkTextFontScale
Gets or sets the percentage of the original font size to which each TextRun in the TextBox is scaled when AutoFit is ShrinkTextOnOverflow.
Default value is 1 if AutoFit is ShrinkTextOnOverflow; otherwise, System.Double.NaN.
This property is not applicable on a TextBox within a TableCell.
public double AutoFitShrinkTextFontScale { get; set; }
Public Property AutoFitShrinkTextFontScale As Double
Property Value
- System.Double
The percentage of the original font size to which each TextRun in the TextBox is scaled when AutoFit is ShrinkTextOnOverflow.
Remarks
In order to auto-fit text within a bounding box it is sometimes necessary to decrease the font size by a certain percentage. Using this property the font within a text box can be scaled based on the value provided. A value of 1 scales the text to 100%, while a value of 0.01 scales the text to 1%.
Exceptions
- System.InvalidOperationException
Property AutoFitShrinkTextFontScale can be set only if property AutoFit is ShrinkTextOnOverflow.
- System.ArgumentOutOfRangeException
Value is not between 0 and 1.
AutoFitShrinkTextLineSpaceReduction
Gets or sets the percentage amount by which the line spacing of each TextParagraph in the TextBox is reduced when AutoFit is ShrinkTextOnOverflow.
This property applies only to paragraphs with percentage line spacing.
Default value is 0 if AutoFit is ShrinkTextOnOverflow; otherwise, System.Double.NaN.
This property is not applicable on a TextBox within a TableCell.
public double AutoFitShrinkTextLineSpaceReduction { get; set; }
Public Property AutoFitShrinkTextLineSpaceReduction As Double
Property Value
- System.Double
The percentage amount by which the line spacing of each TextParagraph in the TextBox is reduced when AutoFit is ShrinkTextOnOverflow.
Remarks
The reduction is applied by subtracting it from the original line spacing value. Using this property the vertical spacing between the lines of text can be scaled by a percent amount. A value of 1 reduces the line spacing by 100%, while a value of 0.01 reduces the line spacing by one percent.
Exceptions
- System.InvalidOperationException
Property AutoFitShrinkTextLineSpaceReduction can be set only if property AutoFit is ShrinkTextOnOverflow.
- System.ArgumentOutOfRangeException
Value is not between 0 and 1.
Centered
Gets or sets a value indicating the centering of the text box.
The way it works fundamentally is to determine the smallest possible "bounds box" for the text and then to center that "bounds box" accordingly. This is different than Alignment, which aligns the text within the "bounds box" for the text.
This property is compatible with all of the different kinds of VerticalAlignment.
Default value is false.
This member is currently not supported in PDF, XPS, and image formats.
Property Value
- System.Boolean
true if the text box is horizontally centered; otherwise, false.
ColumnNumber
Gets or sets the number of columns of text in the bounding rectangle.
Default value is 1.
This property is not applicable on a TextBox within a TableCell.
This member is currently not supported in PDF, XPS, and image formats.
Property Value
- System.Int32
The number of columns of text in the bounding rectangle.
Remarks
When applied to a TextBox this property takes the width of the bounding box for the text and divides it by the number of columns specified. These columns are then treated as overflow containers in that when the previous column has been filled with text the next column acts as the repository for additional text. When all columns have been filled and text still remains then the overflow properties set for this TextBox are used and the text is reflowed to make room for additional text.
Exceptions
- System.ArgumentOutOfRangeException
Value is less than 1.
ColumnSpacing
Gets or sets the space between text columns when there is more than 1 column present in the TextBox.
Default value is 0.
This property is not applicable on a TextBox within a TableCell.
This member is currently not supported in PDF, XPS, and image formats.
Property Value
Exceptions
- System.ArgumentOutOfRangeException
Value is less than zero.
InternalMarginBottom
Gets or sets the bottom internal margin of the TextBox bounding rectangle within a Shape or a TableCell.
Default value is 0.05 inches.
public Length InternalMarginBottom { get; set; }
Public Property InternalMarginBottom As Length
Property Value
Exceptions
- System.ArgumentOutOfRangeException
Value is less than zero.
InternalMarginLeft
Gets or sets the left internal margin of the TextBox bounding rectangle within a Shape or a TableCell.
Default value is 0.1 inches.
Property Value
Exceptions
- System.ArgumentOutOfRangeException
Value is less than zero.
InternalMarginRight
Gets or sets the right internal margin of the TextBox bounding rectangle within a Shape or a TableCell.
Default value is 0.1 inches.
public Length InternalMarginRight { get; set; }
Public Property InternalMarginRight As Length
Property Value
Exceptions
- System.ArgumentOutOfRangeException
Value is less than zero.
InternalMarginTop
Gets or sets the top internal margin of the TextBox bounding rectangle within a Shape or a TableCell.
Default value is 0.05 inches.
Property Value
Exceptions
- System.ArgumentOutOfRangeException
Value is less than zero.
TextDirection
Gets or sets the text direction.
Default value is Horizontal.
public TextDirection TextDirection { get; set; }
Public Property TextDirection As TextDirection
Property Value
The text direction.
VerticalAlignment
Gets or sets the vertical alignment of the text within an object such as a Shape or a TableCell.
Default value is Top.
public VerticalAlignment VerticalAlignment { get; set; }
Public Property VerticalAlignment As VerticalAlignment
Property Value
WrapText
Gets or sets a value indicating whether to wrap text in shape.
Default value is true.
This property is not applicable on a TextBox within a TableCell.
Property Value
- System.Boolean
true if words are wrapped within the bounding rectangle; otherwise, false if words spill out without paying attention to the bounding rectangle boundaries.