HotXLS 文档

SetAutoFilter 方法

设置 the classic XLS AutoFilter range for the worksheet

语法

procedure SetAutoFilter(ARow1, ACol1, ARow2, ACol2: Integer); overload;
procedure SetAutoFilter(ARange: WideString); overload;

备注

数字重载使用从 1 开始的行号和列号。字符串重载接受 A1 样式的范围,例如 A1:C5。以 BIFF8 保存时会写出工作表 AutoFilter 记录和匹配的内置筛选数据库名称
To set a field condition while creating the range, call TXLSWorksheet.ApplyAutoFilter. To apply criteria to an existing range object, call IXLSRange.Autofilter(Field, Criteria) on the target range

示例

Workbook := TXLSWorkbook.Create;
try
  Sheet := Workbook.Sheets[1];
  Sheet.SetAutoFilter('A1:C5');
  Workbook.SaveAs('filtered.xls', xlExcel97);
finally
  Workbook.Free;
end;

See Also