Fix XLSX reading when shared strings is missing the uniqueCount attribute (#255)
Use "count" attribute as a fallback
This commit is contained in:
1 parent
a43c13a36f
commit
1891c0b053
3 files changed
+23
-1
No files matched your search
@@ -159,7 +159,15 @@ class SharedStringsHelper
|
||||
$xmlReader->read();
|
||||
}
|
||||
|
||||
return intval($xmlReader->getAttribute('uniqueCount'));
|
||||
$uniqueCount = $xmlReader->getAttribute('uniqueCount');
|
||||
|
||||
// some software do not add the "uniqueCount" attribute but only use the "count" one
|
||||
// @see https://github.com/box/spout/issues/254
|
||||
if ($uniqueCount === null) {
|
||||
$uniqueCount = $xmlReader->getAttribute('count');
|
||||
}
|
||||
|
||||
return intval($uniqueCount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user