FormattedText: String;
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 on this form named the 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.
To execute the example a form, a button named Button1 placed on this form, the TabSheetBoxNet component, and the UiTabSheetNet component named UiTabSheetNet1 are required. The UiTabSheetNet1 is the data source for TabSheetBoxNet.
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
TSheet: ITabSheet;
TRange: ITabRange;
s: String;
Begin
TSheet := UiTabSheetNet1.TabSheetUi.TabSheet;
TRange := TSheet.Cell[0, 0];
TRange.Style.CustomFormat := "0,00;\u0022minus \u0022 0,00";
TRange.Value := -10;
s := TRange.FormattedText;
Debug.WriteLine(s);
End Sub;
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: