HotXLS 文档

FindText 方法

Finds the first loaded classic XLS text cell that contains the requested text

语法

function FindText(SearchText: WideString; out Row: Integer; out Col: Integer): Boolean; overload;
function FindText(SearchText: WideString; out Row: Integer; out Col: Integer; MatchCase: Boolean): Boolean; overload;

备注

FindText 按行优先顺序扫描既有工作表单元格,返回第一个匹配项的从 1 开始的公开行号和列号
The two-parameter overload is case-insensitive. Pass True for MatchCase (当搜索必须精确匹配原始大小写时)。公式单元格和非文本单元格会被跳过
When no match is found, the method returns False and sets both coordinates to zero

示例

if Workbook.Sheets[1].FindText('[CONTACT]', Row, Col) then
  Workbook.Sheets[1].Cells[Row, Col].Value := 'John Smith';

See Also