Creates an independent classic XLS drawing text box and returns a
TXLSTextBox object that represents the new shape.
Syntax
function AddTextBox(AText: WideString; ARow1, ACol1, ARow2, ACol2: Integer):
TXLSTextBox;
| AText |
Required WideString. The initial text stored in the text box. |
| ARow1, ACol1 |
Required Integer values. One-based row and column for the upper-left anchor. |
| ARow2, ACol2 |
Required Integer values. One-based row and column for the lower-right anchor. |
Remarks
AddTextBox creates a worksheet drawing object. It does not create a cell comment and does not add a
Note record to the workbook. Use the returned
TXLSTextBox to change the text, anchor, text runs, line formatting, fill formatting, or to delete the shape.
Example
This example creates a text box on sheet one and applies simple line and fill formatting.
Var
TextBox: TXLSTextBox;
begin
With Workbook.Sheets[1] do begin
TextBox := Shapes.AddTextBox('Standalone note', 2, 2, 5, 6);
TextBox.Fill.ForeColor.RGB := $00FFFF;
TextBox.Line.ForeColor.RGB := $0000FF;
TextBox.TextRuns.Add(0, 1);
end;
end;