sc/source/filter/excel/xecontent.cxx |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit a63bd448c84c8b337b099d3b0c027f40516bc603
Author:     Paris Oplopoios <paris.oplopo...@collabora.com>
AuthorDate: Thu Oct 26 12:35:23 2023 +0300
Commit:     Paris Oplopoios <parisop...@gmail.com>
CommitDate: Sat Oct 28 22:26:11 2023 +0200

    sc: Export conditional formatting expression correctly for text rules
    
    Text rules like BeginsWith would discard the expression if it was a
    number when exporting, which is not what is supposed to happen - as
    something like a conditional formatting rule BeginsWith "1" should be
    valid.
    
    Change-Id: I2d53754c462403f20b1991fa201184fcab3616a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158440
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Paris Oplopoios <parisop...@gmail.com>

diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 316fe673c359..71bf09cc84f5 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1057,7 +1057,22 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
         // the token array for that
         std::unique_ptr<ScTokenArray> 
pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0));
         if(pTokenArray->GetLen())
-            aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+        {
+            formula::StackVar eType = pTokenArray->FirstToken()->GetType();
+            switch (eType)
+            {
+                case formula::svDouble:
+                {
+                    aText = 
OString::number(pTokenArray->FirstToken()->GetDouble());
+                    break;
+                }
+                default:
+                {
+                    aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+                    break;
+                }
+            }
+        }
     }
 
     sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();

Reply via email to