FormattingStyle Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets or sets the formatting style of the selected text.
Syntax
public string FormattingStyle { get; set; }Public Property FormattingStyle As StringExamples
The following example formats the heading of a short document by using Selection.FormattingStyle.
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, 17);
Selection selection = textControl.Selection;
selection.FormattingStyle = "Heading 1";
if (!string.IsNullOrWhiteSpace(selection.FormattingStyle))
{
Console.WriteLine($"Formatting Style: {selection.FormattingStyle}");
}textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
textControl.Select(0, 17)
Dim selection As Selection = textControl.Selection
selection.FormattingStyle = "Heading 1"
If Not String.IsNullOrWhiteSpace(selection.FormattingStyle) Then
Console.WriteLine($"Formatting Style: {selection.FormattingStyle}")
End IfLimitations
Runtime only.
Remarks
The property returns an empty string when the text selection contains multiple characters with different styles. The Selection.IsCommonValueSelected method can be used to check for mixed attributes.