尝试循环进入每个工作表并清除 C 列中的任何 , 我收到消息 setactive index is out of bounds 请帮助。我已经添加了我的代码是否缺少步骤。
<?php
include'../Classes/PHPExcel.php';
include'../Classes/PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("../upload/combined.xlsx");
ini_set('max_execution_time', 2000);
$i = 0;
while ($objPHPExcel->setActiveSheetIndex($i)){
$objWorksheet = $objPHPExcel->getActiveSheet();
$highestRow = $objWorksheet->getHighestRow();
for($cl=0;$cl<$highestRow+1;$cl++){
$clean=$objPHPExcel->getActiveSheet()->getCell('C'.$cl)->getValue();
$cleandone=str_replace(',',"",$clean);
$objWorksheet->setCellValue('C'.$cl,$cleandone);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('../upload/combined.xlsx');
$i++;
}
}
echo "Done";
?>