From 789964785a61daab5f8065f006dd7aaf843c7236 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 9 Feb 2024 12:01:39 +0100 Subject: tdf#159483 sc HTML import: handle data-sheets-value attribute for the num case E.g. have "1,000.00" and "2,000.00" in two cells, paste that into calc, and try to do a SUM() on them, which will fail because the cell content is text. Just data-sheets-value itself would not be good solution, because then we would lose the number format, so the paste result would be like 1000, which is bad for readability if you don't want further operations on the value. Fix the problem by also parsing the data-sheets-numberformat attribute, so far what's clear is that the "2" JSON key there provides a number format string which matches the syntax of Excel/Calc. This gives the best of the two worlds: the output looks like the original, but SUM() works on the cells as well. Change-Id: Ic7c09ba55a51852f285ad0c05ed42c6771b0f500 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163152 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- include/svtools/htmlkywd.hxx | 1 + include/svtools/htmltokn.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/include/svtools/htmlkywd.hxx b/include/svtools/htmlkywd.hxx index 23e836ea7cea..80e47b100187 100644 --- a/include/svtools/htmlkywd.hxx +++ b/include/svtools/htmlkywd.hxx @@ -447,6 +447,7 @@ #define OOO_STRING_SVTOOLS_HTML_O_SDval "sdval" #define OOO_STRING_SVTOOLS_HTML_O_DSval "data-sheets-value" #define OOO_STRING_SVTOOLS_HTML_O_SDnum "sdnum" +#define OOO_STRING_SVTOOLS_HTML_O_DSnum "data-sheets-numberformat" #define OOO_STRING_SVTOOLS_HTML_O_sdlibrary "sdlibrary" #define OOO_STRING_SVTOOLS_HTML_O_sdmodule "sdmodule" #define OOO_STRING_SVTOOLS_HTML_O_sdevent "sdevent-" diff --git a/include/svtools/htmltokn.h b/include/svtools/htmltokn.h index 27370e5cb869..21fcec800a9a 100644 --- a/include/svtools/htmltokn.h +++ b/include/svtools/htmltokn.h @@ -346,6 +346,7 @@ STRING_START = BOOL_END, SDVAL, // StarDiv NumberValue DSVAL, SDNUM, // StarDiv NumberFormat + DSNUM, SDLIBRARY, SDMODULE, STRING_END, -- cgit