i'm trying to read some excel files with phpexcel, which works ok so far. phpexcel is a bit too clever though, and removes leading zeros from my cells. i guess i need to tell it to treat the cell as a text string, not as general or number. but i've failed. i even found threads on stackoverflow about this but the suggested solutions simply wouldn't work.
below is a snippet of the stuff i'm working on.
foreach(@$objWorksheet->getRowIterator() as $row){
$cellIterator = $row->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(false);
foreach($cellIterator as $cell){
#$objWorksheet->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode('@');
$cells[] = $cell->getValue();
}
}
any idea? i don't want to limit myself to only read numeric content, as i don't have any control over what the users will upload. treating everything as strings would be perfect.
/peder