Format cell as text PHPExcel

I use the below to prepare my Excel sheet
 $objPHPExcel->getActiveSheet()->fromArray($datasource, 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->getActiveSheet()->getStyle(bla,bla)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);

Here
stackoverflow.com/questions/12457610/reading-numbers-as-text-format-with-phpexcel
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.
LVL 1
myyisAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
... I believe that it is much more faster.
Recommendation: Try using the binder approach suggested in the Stack answer, and see if it will give you the formatting you require.  Once that works and you're getting the formatting, then turn to the question of finding a faster way.  Premature optimization is an anti-practice; we want functionality first, and can optimize through refactoring later.  

But having read the Stack answer and code sample, I will bet you cannot find any way to make it run faster because you won't even be able to detect it in action.  All it does is move data around in memory, and it's very hard to get any optimization in something that is measured in nanoseconds.  Think about it - to achieve a 1 second improvement, you would have to shave a nanosecond off of a billion actions.  Speed optimizations make sense when you're dealing with the I/O subsystem but rarely matter with in-memory code.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
myyisAuthor Commented:
Hi,
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.
myyisAuthor Commented:
Used the binder and worked. Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.