mercredi 9 mai 2018

PHP Com Excel Apply Filters

I am opening excel with com and it is working fine however I am having trouble apply two filters at the same time to same column. Here is the code:

$excel = new COM("excel.application") or die("Unable to instanciate excel");
$excel->Visible = 1;
$excel->DisplayAlerts = 1;

$wb = $excel->Workbooks->Open($dataFile);
$sheet = $wb->Worksheets(1);

// apply filters
$sheet->range("AS1")->AutoFilter(45, '<>'); // works with single filter

However when I want to apply two filters at the same time to same column, it doesnt work:

$sheet->range("AS1")->AutoFilter(45, '<> AND > 0'); // DOES NOT WORK

Any help will be greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire