TX Text Control .NET for Windows Forms

NumberFormat Property

Property|Introduced in 26.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

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; }

Examples

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}");
}

Further Reading