Method Format
Format()
Returns the formatted text, constrained to ConstrainToSize.
public string Format()
Returns
- string
The formatted text.
Remarks
If NeedsFormat is true, causes a format, resetting NeedsFormat to false.
Format(string, int, Alignment, bool, bool, int, TextDirection, bool, TextFormatter?)
Formats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
public static List<string> Format(string text, int width, Alignment textAlignment, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom, bool multiLine = false, TextFormatter? textFormatter = null)
Parameters
textstringwidthintThe number of columns to constrain the text to for word wrapping and clipping.
textAlignmentAlignmentSpecifies how the text will be aligned horizontally.
wordWrapboolIf true, the text will be wrapped to new lines no longer than
width. If false, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped towidth.preserveTrailingSpacesboolIf true trailing spaces at the end of wrapped lines will be preserved. If false , trailing spaces at the end of wrapped lines will be trimmed.
tabWidthintThe number of columns used for a tab.
textDirectionTextDirectionThe text direction.
multiLineboolIf true new lines are allowed.
textFormatterTextFormatterTextFormatter instance to access any of his objects.
Returns
Remarks
An empty text string will result in one empty line.
If width is 0, a single, empty line will be returned.
If width is int.MaxValue, the text will be formatted to the maximum width possible.
Format(string, int, bool, bool, bool, int, TextDirection, bool, TextFormatter?)
Formats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
public static List<string> Format(string text, int width, bool justify, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom, bool multiLine = false, TextFormatter? textFormatter = null)
Parameters
textstringwidthintThe number of columns to constrain the text to for word wrapping and clipping.
justifyboolSpecifies whether the text should be justified.
wordWrapboolIf true, the text will be wrapped to new lines no longer than
width. If false, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped towidth.preserveTrailingSpacesboolIf true trailing spaces at the end of wrapped lines will be preserved. If false , trailing spaces at the end of wrapped lines will be trimmed.
tabWidthintThe number of columns used for a tab.
textDirectionTextDirectionThe text direction.
multiLineboolIf true new lines are allowed.
textFormatterTextFormatterTextFormatter instance to access any of his objects.
Returns
Remarks
An empty text string will result in one empty line.
If width is 0, a single, empty line will be returned.
If width is int.MaxValue, the text will be formatted to the maximum width possible.