svl/source/numbers/zformat.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 9b6805db873b26a22eda8cd35d6553e463775324
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Mon Mar 15 15:49:55 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Mar 16 17:56:58 2021 +0100

    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 <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 3e73d3475711b790cc80b9a286c5d454f3929384)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112519
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to