summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2023-04-27 14:56:36 +0200
committerEike Rathke <erack@redhat.com>2023-04-27 18:19:05 +0200
commite59fdc8b800aa3ab551b3f4fec4bc58366df582e (patch)
tree1a23399adebcb19e3f7b716d1fa0cc7473f959f7 /sc/source
parentbb28a0e8b914edf1fe2aac0cd1a876b976f61300 (diff)
Resolves: tdf#155046 Accept true and false as 1 and 0 for OOXML boolean cells
Encountered in the wild written by https://www.npmjs.com/package/excel4node https://github.com/advisr-io/excel4node/blob/c14213abb9a511ff786c574e473f53006a85e4f9/source/lib/cell/cell.js#L74 Change-Id: Ib21242a55f0d8530fd9120b07a096a9908f451bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151101 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/filter/oox/sheetdatacontext.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx
index c1a270afb41a..bc5855e9f4b7 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -185,7 +185,16 @@ void SheetDataContext::onEndElement()
mrSheetData.setValueCell( maCellData, maCellValue.toDouble() );
break;
case XML_b:
- mrSheetData.setBooleanCell( maCellData, maCellValue.toDouble() != 0.0 );
+ {
+ // Some generators may write true or false instead of 1 or 0.
+ /* XXX NOTE: PivotCacheItem::readBool() may suffer from this as
+ * well, but for now let's assume that software writing this
+ * here wrong won't write pivot caches at all.. */
+ bool bValue = (maCellValue.toDouble() != 0.0);
+ if (!bValue && maCellValue.equalsIgnoreAsciiCase(u"true"))
+ bValue = true;
+ mrSheetData.setBooleanCell( maCellData, bValue );
+ }
break;
case XML_e:
mrSheetData.setErrorCell( maCellData, maCellValue );