HotXLS ドキュメント

ApplyAutoFilter メソッド

従来の XLS AutoFilter 範囲を設定し、フィールドごとの条件を 1 回の呼び出しで適用します

構文

procedure ApplyAutoFilter(ARange: WideString; Field: Integer; Criteria1: Variant); overload;
procedure ApplyAutoFilter(ARange: WideString; Field: Integer; Criteria1: Variant; Operator: XlAutoFilterOperator; Criteria2: Variant); overload;
procedure ApplyAutoFilter(ARow1, ACol1, ARow2, ACol2: Integer; Field: Integer; Criteria1: Variant); overload;
procedure ApplyAutoFilter(ARow1, ACol1, ARow2, ACol2: Integer; Field: Integer; Criteria1: Variant; Operator: XlAutoFilterOperator; Criteria2: Variant); overload;

備考

The string overload accepts an A1-style range such as A1:C5. The numeric overload uses 1-based row and column indexes. Field is also 1-based within the AutoFilter range
ApplyAutoFilter replaces any existing worksheet-level AutoFilter range with the supplied range, then writes the same BIFF8 field criteria records used by IXLSRange.Autofilter
Use TXLSWorksheet.AutoFilterColumns to inspect the stored per-field criteria after applying or reading a classic XLS AutoFilter

関連項目

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

関連項目