diff options
author | Laurent Balland <laurent.balland@mailo.fr> | 2023-02-04 09:29:20 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2023-08-25 17:49:17 +0200 |
commit | 74d9da037cac01c5abd768a99b2f948553fbf144 (patch) | |
tree | d91cf6581202c313f9a9c74fcc9f4ef31eb6928e /sc | |
parent | c7b59c9484ae6ff88cd8d7017aeb83b02e212c9c (diff) |
tdf#152724 Extend ODF for blank width "_x"
Number format code "_x" is currently saved as a text string containing a
number of spaces corresponding to the width of character "x". It may be
confusing for user if its format code is modified.
This change introduces a new XML tag XML_BLANK_WIDTH_CHAR to replace the
previous text string if ODF version is extended
<number:text> and <number:embedded-text>:
the attribute is composed of a string containing the used character and its
position in the text string (if position is 0, it is omitted).
Several blank code characters are separated by '_'.
Replacement blanks in the text string are preserved to enable compatibility.
Example: format code
"foo"_M_I_N"!"???,???.000_.000"!"_)
is saved as:
<number:number-style style:name="N173">
<number:text loext:blank-width-char="M3_I6_N7">foo !</number:text>
<number:number number:decimal-places="6" number:min-decimal-places="6" number:min-integer-digits="6" loext:max-blank-integer-digits="6" number:grouping="true">
<number:embedded-text number:position="-4" loext:blank-width-char="."> </number:embedded-text>
</number:number>
<number:text loext:blank-width-char=")1">! </number:text>
</number:number-style>
Add QA test
Change-Id: I785e1a14ecccc900e9fd5af88dd7b743fefcc48c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146582
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/ods/tdf152724-Blank-width-char.ods | bin | 0 -> 8782 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export_test4.cxx | 13 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/tdf152724-Blank-width-char.ods b/sc/qa/unit/data/ods/tdf152724-Blank-width-char.ods Binary files differnew file mode 100644 index 000000000000..4716d4be5355 --- /dev/null +++ b/sc/qa/unit/data/ods/tdf152724-Blank-width-char.ods diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 74313ef67c27..357ac567575f 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1480,6 +1480,19 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testSecondsWithoutTruncateAndDecimals) lcl_TestNumberFormat(*getScDoc(), "[SS].00"); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testBlankWidthCharacter) +{ + createScDoc("ods/tdf152724-Blank-width-char.ods"); + + // save to ODS and reload + saveAndReload("calc8"); + lcl_TestNumberFormat(*getScDoc(), "[>0]_-?0;[<0]-?0;_-?0;@"); + + // save to XLSX and reload + saveAndReload("Calc Office Open XML"); + lcl_TestNumberFormat(*getScDoc(), "_-?0;-?0;_-?0;@"); +} + CPPUNIT_TEST_FIXTURE(ScExportTest4, testEmbeddedTextInDecimal) { createScDoc("xlsx/embedded-text-in-decimal.xlsx"); |