HotXLS 文档

AddTextBox 方法

按从 1 开始的工作表锚点添加经典 XLS 绘图文本框,并返回创建好的 TXLSTextBox object

语法

function AddTextBox(AText: WideString; ARow1, ACol1, ARow2, ACol2: Integer): TXLSTextBox;
function AddTextBox(AText: WideString; ARange: WideString): TXLSTextBox;
    

参数

AText Initial text stored in the text box
ARow1, ACol1 One-based row and column for the upper-left anchor
ARow2, ACol2 One-based row and column for the lower-right anchor
ARange A1-style worksheet range such as C4:F8

备注

AddTextBox 是一个工作表级的捷径,经由工作表 Shapes collection
该方法不会创建单元格批注,也不会把文本附加到单元格 note 记录

示例

var
  TextBox: TXLSTextBox;
begin
  TextBox := Workbook.Sheets[1].AddTextBox(
    'Standalone note',
    2, 3,
    5, 7);
  TextBox.Fill.ForeColor.RGB := $00FFFF;

  TextBox := Workbook.Sheets[1].AddTextBox(
    'Range note',
    'C4:F8');
end;
    

请参阅

TXLSWorksheet class
TXLSWorksheet.Shapes 属性
TXLSShapes.AddTextBox 方法
TXLSTextBox class