diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2024-02-09 12:01:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-02-09 15:02:51 +0100 |
commit | c02b8ee05df2d0cef326112ff22c85790ddc0ccc (patch) | |
tree | 9b1a3e35558d20afad6b7e55aba7d9995e9e27f1 /include | |
parent | 6e916f361455807be495495822b2e42a11760132 (diff) |
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.
(cherry picked from commit 789964785a61daab5f8065f006dd7aaf843c7236)
Change-Id: Ic7c09ba55a51852f285ad0c05ed42c6771b0f500
Diffstat (limited to 'include')
-rw-r--r-- | include/svtools/htmlkywd.hxx | 1 | ||||
-rw-r--r-- | include/svtools/htmltokn.h | 1 |
2 files changed, 2 insertions, 0 deletions
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, |