Unless you use
, then PHPExcel uses a
to identify the datatype that you are setting in the cell.
By default, this is
, which performs a very simplistic check on whether the PHP datatype is Null or Boolean, or a numeric value or a string. A value such as
is a PHP string, so will be treated as a string.
There is also an advanced
) that can perform much more sophisticated checks, and is capable of identifying strings containing basic date formats and converting them to an Excel serialized
datetime, and setting a number format mask accordingly. It can also detect currency values, fractions, and (most importantly) percentages.
If you pass a string value like
through the advanced value binder, it will divide the numeric part by 100, and set the number format mask to a percentage mask, in exactly the same way as the MS Excel GUI.
To enable the advanced value binder, call
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
before instantiating your PHPExcel object.
You can find an example of advanced binder usage in