php - How to remove the top two empty rows in the excel sheet? -
below sample codes. it's may you.. when i'm change row number(1) 5 7 rows empty in excel sheet.(location : setcellvaluebycolumnandrow($col, 1, $field);)
$objphpexcel = new phpexcel(); $objphpexcel->getproperties()->settitle("export")->setdescription("none"); $objphpexcel->setactivesheetindex(0); $fields = array('ram','one','two'); $col = 0; foreach ($fields $field) { $objphpexcel->getactivesheet()->setcellvaluebycolumnandrow($col, 1, $field); $col++; } header('content-type: text/csv'); header('content-disposition: attachment;filename="export.csv"'); header('cache-control: max-age=0'); $objwriter->save('php://output');
$objphpexcel = new phpexcel(); $objphpexcel->getproperties()->settitle("export")->setdescription("none"); $objphpexcel->setactivesheetindex(0); $field = array('ram','one','two'); $col = 0; foreach ($fields $field) { if(empty($field)){ $objphpexcel->getactivesheet()->setcellvaluebycolumnandrow($col, 1, $field); $col++; } } header('content-type: text/csv'); header('content-disposition: attachment;filename="export.csv"'); header('cache-control: max-age=0'); $objwriter->save('php://output');
Comments
Post a Comment