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 for the table cell. It 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.
Syntax
public string NumberFormat { get; set; }Public Property NumberFormat As StringExamples
The following example creates a small report table and works with its structure by using TableCellFormat.NumberFormat.
textControl.Tables.Add(3, 3, 10);
Table table = textControl.Tables.GetItem(10);
TableCellFormat tableCellFormat = table.Cells[1, 1].CellFormat;
tableCellFormat.NumberFormat = "0.00";
if (!string.IsNullOrWhiteSpace(tableCellFormat.NumberFormat))
{
Console.WriteLine($"Number Format: {tableCellFormat.NumberFormat}");
}textControl.Tables.Add(3, 3, 10)
Dim table As Table = textControl.Tables.GetItem(10)
Dim tableCellFormat As TableCellFormat = table.Cells(1, 1).CellFormat
tableCellFormat.NumberFormat = "0.00"
If Not String.IsNullOrWhiteSpace(tableCellFormat.NumberFormat) Then
Console.WriteLine($"Number Format: {tableCellFormat.NumberFormat}")
End If