summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-03-15 15:49:55 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-03-16 17:56:58 +0100
commit9b6805db873b26a22eda8cd35d6553e463775324 (patch)
tree7958dda4ed3f0e8db1474071a5ad625f9c59574a
parent8926d9282fe84793ce909471b5caec3583fd3ec9 (diff)
xls save: fix writing inline calendar modifiers as format code, don't
E.g. ja-JP GGGE [~gregorian]YYYY saved as OOXML ended up as [$-411]ggge\ gregorianyyyy which when reloaded became GGGE GREGoRianYYYY displaying 令和3 R033Ro03ian2021 (whatever Xcl might have done with that). Change-Id: If8a7d5b837b69c32afacc7a8d7646fedc84ab87a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112510 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 3e73d3475711b790cc80b9a286c5d454f3929384) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112519 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svl/source/numbers/zformat.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 92e62e87aeae..6402aa7f5dbc 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -5309,6 +5309,8 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
}
break;
case NF_SYMBOLTYPE_CALDEL :
+ if (j + 1 >= nCnt)
+ break;
if ( rStrArray[j+1] == "gengou" )
{
nCalendarID = 0x0030000;
@@ -5325,9 +5327,10 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{
nCalendarID = 0x0080000;
}
- // other calendars (see tdf#36038) not corresponding between LibO and XL
- if ( nCalendarID > 0 )
- j = j+2;
+ // Other calendars (see tdf#36038) not corresponding between LibO and XL.
+ // However, skip any calendar modifier and don't write
+ // as format code (if not as literal string).
+ j += 2;
break;
case NF_SYMBOLTYPE_CURREXT :
nPosHaveLCID = aStr.getLength();