NumberFormat Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets or sets a number format which can be used to automatically format numbers in table cells. When a formula is defined the automatically calculated text can also be formatted with a number format. When a number format is not defined, the property's value is an empty string. The number format string has a format as described in Office Open XML File Formats - ISO/IEC 29500 - 1, Chapter: 18.8.31 Number Formats. See Formatting Text by using Number Formats for more information. If text is selected, the property specifies the number format of the whole selected text.
Syntax
public string NumberFormat { get; set; }Public Property NumberFormat As StringExamples
The following example changes the formatting applied to text entered at the end of a document by using InputFormat.NumberFormat.
textControl.Text = "Project summary";
textControl.InputPosition = new InputPosition(textControl.Text.Length);
InputFormat inputFormat = textControl.InputFormat;
inputFormat.NumberFormat = "0.00";
if (!string.IsNullOrWhiteSpace(inputFormat.NumberFormat))
{
Console.WriteLine($"Number Format: {inputFormat.NumberFormat}");
}textControl.Text = "Project summary"
textControl.InputPosition = New InputPosition(textControl.Text.Length)
Dim inputFormat As InputFormat = textControl.InputFormat
inputFormat.NumberFormat = "0.00"
If Not String.IsNullOrWhiteSpace(inputFormat.NumberFormat) Then
Console.WriteLine($"Number Format: {inputFormat.NumberFormat}")
End IfRemarks
The property returns null when the text selection contains multiple table cells with different number formats.