mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 14:56:04 +03:00
Fix to OOCalc Reader for percentage and currency datatypes
This commit is contained in:
parent
19dfbfe418
commit
868d14a84d
@ -574,6 +574,22 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
$dataValue = ($allCellDataText == 'TRUE') ? True : False;
|
||||
break;
|
||||
case 'percentage' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
if (floor($dataValue) == $dataValue) {
|
||||
$dataValue = (integer) $dataValue;
|
||||
}
|
||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00;
|
||||
break;
|
||||
case 'currency' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
if (floor($dataValue) == $dataValue) {
|
||||
$dataValue = (integer) $dataValue;
|
||||
}
|
||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
||||
break;
|
||||
case 'float' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||
@ -640,8 +656,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
// echo 'Forumla result is '.$dataValue.'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($dataValue);
|
||||
}
|
||||
if (($cellDataOfficeAttributes['value-type'] == 'date') ||
|
||||
($cellDataOfficeAttributes['value-type'] == 'time')) {
|
||||
if ($formatting !== NULL) {
|
||||
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rowID)->getNumberFormat()->setFormatCode($formatting);
|
||||
}
|
||||
if ($hyperlink !== NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user