myyis
asked on
Format cell as text PHPExcel
I use the below to prepare my Excel sheet
$objPHPExcel->getActiveShe et()->from Array($dat asource, null, 'A3');
The problem is the values like 22.651 or 22,699 are formatted as numbers by default but I want to format the whole column as text.
I tried this but not worked (it converts 22.651 to 22,651)
$objPHPExcel->getActiveShe et()->getS tyle(bla,b la)->getNu mberFormat ()->setFor matCode(PH PExcel_Sty le_NumberF ormat::FOR MAT_TEXT);
Here
stackoverflow.com/question s/12457610 /reading-n umbers-as- text-forma t-with-php excel
they suggest to use a binder but I want to use fromArray because I believe that it is much more faster.
So keeping fromArray function how can I set the format of specific cells to text (or better set format of all column to text)?
Thank you.
$objPHPExcel->getActiveShe
The problem is the values like 22.651 or 22,699 are formatted as numbers by default but I want to format the whole column as text.
I tried this but not worked (it converts 22.651 to 22,651)
$objPHPExcel->getActiveShe
Here
stackoverflow.com/question
they suggest to use a binder but I want to use fromArray because I believe that it is much more faster.
So keeping fromArray function how can I set the format of specific cells to text (or better set format of all column to text)?
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Used the binder and worked. Thank you.
ASKER
I prefer not to change the whole code.
I prefer keeping fromArray function and set the format of specific cells to text (or better set format of all column to text) if it is possible.