From 512f00d336a5965999b307a319b310d48833909b Mon Sep 17 00:00:00 2001 From: gkostov Date: Fri, 10 Apr 2020 14:40:57 +0300 Subject: [PATCH] Handle the "inlineStr" cell type when reading cell values. https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.cell?view=openxml-2.8.1#remarks --- src/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 59ab38a..8797711 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,9 +61,14 @@ function getTransform(formats: (string | number)[], strings: string[], dict?: IM for (let i = 0; i < children.length; i++) { const ch = children[i]; if (ch.children) { - let value = ch.children.v.value; - if (ch.attribs.t === 's') { - value = strings[value]; + let value: any; + if (ch.attribs.t === 'inlineStr') { + value = ch.children.is.children.t.value; + } else { + value = ch.children.v.value; + if (ch.attribs.t === 's') { + value = strings[value]; + } } value = isNaN(value) ? value : Number(value); let column = ch.attribs.r.replace(/[0-9]/g, ''); @@ -347,4 +352,4 @@ export function getWorksheets(options: IWorksheetOptions) { processWorkbook(); }); }); -} \ No newline at end of file +}