Fix Xlsx reader overriding manually set number format with builtin number format (#1805)
This commit is contained in:
parent
e1ed52ecb6
commit
87c8e95ae9
|
|
@ -488,7 +488,7 @@ class Xlsx extends BaseReader
|
||||||
}
|
}
|
||||||
if (!$this->readDataOnly && $xmlStyles) {
|
if (!$this->readDataOnly && $xmlStyles) {
|
||||||
foreach ($xmlStyles->cellXfs->xf as $xf) {
|
foreach ($xmlStyles->cellXfs->xf as $xf) {
|
||||||
$numFmt = NumberFormat::FORMAT_GENERAL;
|
$numFmt = null;
|
||||||
|
|
||||||
if ($xf['numFmtId']) {
|
if ($xf['numFmtId']) {
|
||||||
if (isset($numFmts)) {
|
if (isset($numFmts)) {
|
||||||
|
|
@ -503,6 +503,7 @@ class Xlsx extends BaseReader
|
||||||
// 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 (
|
if (
|
||||||
|
$numFmt === null &&
|
||||||
(int) $xf['numFmtId'] < 164 &&
|
(int) $xf['numFmtId'] < 164 &&
|
||||||
NumberFormat::builtInFormatCode((int) $xf['numFmtId']) !== ''
|
NumberFormat::builtInFormatCode((int) $xf['numFmtId']) !== ''
|
||||||
) {
|
) {
|
||||||
|
|
@ -515,7 +516,7 @@ class Xlsx extends BaseReader
|
||||||
}
|
}
|
||||||
|
|
||||||
$style = (object) [
|
$style = (object) [
|
||||||
'numFmt' => $numFmt,
|
'numFmt' => $numFmt === null ? NumberFormat::FORMAT_GENERAL : $numFmt,
|
||||||
'font' => $xmlStyles->fonts->font[(int) ($xf['fontId'])],
|
'font' => $xmlStyles->fonts->font[(int) ($xf['fontId'])],
|
||||||
'fill' => $xmlStyles->fills->fill[(int) ($xf['fillId'])],
|
'fill' => $xmlStyles->fills->fill[(int) ($xf['fillId'])],
|
||||||
'border' => $xmlStyles->borders->border[(int) ($xf['borderId'])],
|
'border' => $xmlStyles->borders->border[(int) ($xf['borderId'])],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue