FormattedText: String;
The FormattedText property returns cell value taking into account predefined data format.
This property is relevant only for ranges consisting of a single cell.
Data display format for the range is defined by the CustomFormat property.
Executing the example requires a form, a button located on this form and named Button1, the TabSheetBox component and the UiTabSheet component named UiTabSheet1. UiTabSheet1 is the data source for TabSheetBox.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
TSheet: ITabSheet;
TRange: ITabRange;
s: String;
Begin
TSheet := UiTabSheet1.TabSheet;
TRange := TSheet.Cell(0, 0);
TRange.Style.CustomFormat := "0,00;" + #34 + "minus " + #34 + "0,00";
TRange.Value := -10;
s := TRange.FormattedText;
Debug.WriteLine(s);
End Sub Button1OnClick;
Clicking the button sets numeric format for A0 cell. Negative values are displayed as follows: minus 1234.58. The variable s will contain the formatted value: minus 10.00.
See also: