removeRow can't decrease total Row

Topics: Developer Forum
Dec 8, 2010 at 3:08 PM
Edited Dec 14, 2010 at 1:23 PM

Hi, I try to used removeRow decrease the Row.here is my code:

set_include_path(get_include_path() . PATH_SEPARATOR . './Classes/');

include 'PHPExcel/IOFactory.php'; $reader = PHPExcel_IOFactory::createReader('Excel5');

$PHPExcel = $reader->load("data.xls");

$sheet = $PHPExcel->getSheet(0);

$highestRow = $sheet->getHighestRow();

$PHPExcel->getActiveSheet()->removeRow($highestRow, 1);

$PHPExcel->garbageCollect(); $objWriter = PHPExcel_IOFactory::createWriter($PHPExcel, 'Excel5');

$objWriter->save('data.xls');

I'm sure "removeRow" clear the data of row, but the total row does not decrease when I read the file again. someone can help me?