Inline strings can contain multiple value nodes
We were working under the assumption that XLSX's inline strings only had a single value node (`<t>`). This is incorrect. To get the actual value of an inline string node, we need to concatenate the value of all its child nodes.
This commit is contained in:
1 parent
69eeeff478
commit
fde8a495ca
5 files changed
+30
-7
No files matched your search
@@ -122,10 +122,15 @@ class CellValueFormatter
|
||||
*/
|
||||
protected function formatInlineStringCellValue($node)
|
||||
{
|
||||
// inline strings are formatted this way:
|
||||
// <c r="A1" t="inlineStr"><is><t>[INLINE_STRING]</t></is></c>
|
||||
$tNode = $node->getElementsByTagName(self::XML_NODE_INLINE_STRING_VALUE)->item(0);
|
||||
$cellValue = $this->escaper->unescape($tNode->nodeValue);
|
||||
// inline strings are formatted this way (they can contain any number of <t> nodes):
|
||||
// <c r="A1" t="inlineStr"><is><t>[INLINE_STRING]</t><t>[INLINE_STRING_2]</t></is></c>
|
||||
$tNodes = $node->getElementsByTagName(self::XML_NODE_INLINE_STRING_VALUE);
|
||||
|
||||
$cellValue = '';
|
||||
for ($i = 0; $i < $tNodes->count(); $i++) {
|
||||
$tNode = $tNodes->item($i);
|
||||
$cellValue .= $this->escaper->unescape($tNode->nodeValue);
|
||||
}
|
||||
|
||||
return $cellValue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user