Docs HotXLS

SetAutoFilter-method

Sets the classic XLS AutoFilter range for the worksheet

Syntaxe

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

Remarques

La surcharge numérique utilise des index de ligne et colonne basés sur 1. La surcharge chaîne accepte une plage de style A1 comme A1:C5. L'enregistrement en BIFF8 écrit les enregistrements AutoFilter de la feuille et le nom de base de données de filtre intégré correspondant
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

Exemple

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

See Also