[Libreoffice-commits] core.git: svl/source xmloff/source

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Fri Oct 7 19:31:24 UTC 2016


 svl/source/numbers/zformat.cxx   |    7 +++++--
 xmloff/source/style/xmlnumfe.cxx |    5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 4b81e61682e7af2af0c00c0a267d4a1f267c45f1
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Thu Sep 22 22:04:38 2016 +0200

    tdf#102370 Correctly export to Excel exponent without sign
    
    Exponent without sign in scientific notation is coded in Excel with a minus
    sign replacing plus sign: 0.00E-00 for instance
    This format is already correctly treated in Calc but was not correctly
    exported to Excel or ODF
    
    Change-Id: Ide117b04e0eb887c6cdd6699ae8ec723d1d29d50
    Reviewed-on: https://gerrit.libreoffice.org/29198
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 17583d4..f4b7834 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -4806,9 +4806,12 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
                         aStr.append( rLocWrp.getNumThousandSep() );
                         break;
                     case NF_SYMBOLTYPE_EXP :
-                        // tdf#95677: Excel does not support exponent without sign
                         aStr.append( rKeywords[NF_KEY_E] );
-                        aStr.append( "+" );
+                        if ( pStr[j].getLength() > 1 && pStr[j][1] == '+' )
+                            aStr.append( "+" );
+                        else
+                        // tdf#102370: Excel code for exponent without sign
+                            aStr.append( "-" );
                         break;
                     case NF_SYMBOLTYPE_DATESEP :
                         aStr.append( rLocWrp.getDateSep() );
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index f449331..3790e79 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1321,8 +1321,9 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
                 case NF_SYMBOLTYPE_EXP:
                     bExpFound = true;           // following digits are exponent digits
                     bInInteger = false;
-                    if ( pElemStr && pElemStr->getLength() == 1 )
-                        bExpSign = false;       // for 0.00E0
+                    if ( pElemStr && ( pElemStr->getLength() == 1
+                                  || ( pElemStr->getLength() == 2 && (*pElemStr)[1] == '-' ) ) )
+                        bExpSign = false;       // for 0.00E0 or 0.00E-00
                     break;
                 case NF_SYMBOLTYPE_CURRENCY:
                     bCurrFound = true;


More information about the Libreoffice-commits mailing list