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
text
stringwidth
intThe number of columns to constrain the text to for word wrapping and clipping.
textAlignment
AlignmentSpecifies how the text will be aligned horizontally.
wordWrap
boolIf 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
.preserveTrailingSpaces
boolIf 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.
tabWidth
intThe number of columns used for a tab.
textDirection
TextDirectionThe text direction.
multiLine
boolIf true new lines are allowed.
textFormatter
TextFormatterTextFormatter 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
text
stringwidth
intThe number of columns to constrain the text to for word wrapping and clipping.
justify
boolSpecifies whether the text should be justified.
wordWrap
boolIf 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
.preserveTrailingSpaces
boolIf 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.
tabWidth
intThe number of columns used for a tab.
textDirection
TextDirectionThe text direction.
multiLine
boolIf true new lines are allowed.
textFormatter
TextFormatterTextFormatter 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.