mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2025-02-16 22:43:21 +03:00
Fix for problem with xlsx files overriding the reserved number format codes below 164 with custom codes
This commit is contained in:
parent
681c30b2ea
commit
cd151ae2e4
@ -500,7 +500,6 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|||||||
if (!$this->readDataOnly && $xmlStyles) {
|
if (!$this->readDataOnly && $xmlStyles) {
|
||||||
foreach ($xmlStyles->cellXfs->xf as $xf) {
|
foreach ($xmlStyles->cellXfs->xf as $xf) {
|
||||||
$numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
|
$numFmt = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
|
||||||
|
|
||||||
if ($xf["numFmtId"]) {
|
if ($xf["numFmtId"]) {
|
||||||
if (isset($numFmts)) {
|
if (isset($numFmts)) {
|
||||||
$tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]"));
|
$tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]"));
|
||||||
@ -513,7 +512,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|||||||
// We shouldn't override any of the built-in MS Excel values (values below id 164)
|
// We shouldn't override any of the built-in MS Excel values (values below id 164)
|
||||||
// But there's a lot of naughty homebrew xlsx writers that do use "reserved" id values that aren't actually used
|
// But there's a lot of naughty homebrew xlsx writers that do use "reserved" id values that aren't actually used
|
||||||
// So we make allowance for them rather than lose formatting masks
|
// So we make allowance for them rather than lose formatting masks
|
||||||
if ((int)$xf["numFmtId"] < 164 && PHPExcel_Style_NumberFormat::builtInFormatCodeIndex((int)$xf["numFmtId"]) !== false) {
|
if ((int)$xf["numFmtId"] < 164 && PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]) !== '') {
|
||||||
$numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]);
|
$numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,6 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||||||
|
|
||||||
// Ensure built-in format codes are available
|
// Ensure built-in format codes are available
|
||||||
self::fillBuiltInFormatCodes();
|
self::fillBuiltInFormatCodes();
|
||||||
|
|
||||||
// Lookup format code
|
// Lookup format code
|
||||||
if (isset(self::$builtInFormats[$pIndex])) {
|
if (isset(self::$builtInFormats[$pIndex])) {
|
||||||
return self::$builtInFormats[$pIndex];
|
return self::$builtInFormats[$pIndex];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user