Prefix: Variant;
Prefix: Object;
The Prefix property determines the table cell prefix.
The prefix is displayed before table cell value. It does not participate in calculation of conditional formatting or calculating formulas.
Executing the example requires a form that contains the Button component with the Button1 identifier, the TabSheetBox component with the TabSheetBox1 identifier and the Source property which is set to the UiErAnalyzer component with the UiErAnalyzer1 identifier. The UiErAnalyzer1 component of the Active property is set to True and the Object property is set to ready express report. The example is a handler of the OnClick event for the Button1 component:
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Tsheet: ITabSheet;
Range: ITabRange;
i, r, c: integer;
Begin
TSheet := TabSheetBox1.Source.GetTabSheet;
r := TSheet.MaxUsedRow;
c := TSheet.MaxUsedColumn;
// Select all tables cells except heading in the range
Range := Tsheet.Cells(1, 0, r, c);
// Determine suffix and prefix to the range
Range.Prefix := "price: ";
Range.Suffix := " $";
// Write particular suffixes and prefixes to the last column
i := 1;
While (i <= r) Do
TSheet.CellPrefix(i, c) := "total: ";
TSheet.CellSuffix(i, c) := " usd";
i := i + 1;
End While;
// Adjust column width to new contents
Range.AdjustWidth;
End Sub Button1OnClick;
As a result of executing the example, after button clicking, prefixes and suffixes are added to table cells.
Before example execution:
After example execution:
Example conditions and result are identical to the Fore Example:
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Tsheet: ITabSheet;
Range: ITabRange;
i, r, c: integer;
Begin
TSheet := TabSheetBoxNet1.Source.GetTabSheet();
r := TSheet.MaxUsedRow;
c := TSheet.MaxUsedColumn;
// Select all tables cells except heading in the range
Range := Tsheet.Cells[1, 0, r, c];
// Determine suffix and prefix to the range
Range.Prefix := "price: ";
Range.Suffix := " $";
// Write particular suffixes and prefixes to the last column
i := 1;
While (i <= r) Do
TSheet.CellPrefix[i, c] := "total: ";
TSheet.CellSuffix[i, c] := " usd";
i := i + 1;
End While;
// Adjust column width to new contents
Range.AdjustWidth();
End Sub;
See also: