sc/qa/unit/subsequent_export_test2.cxx |    3 +--
 sc/source/filter/xml/xmlexprt.cxx      |    3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit eab9015d1e17950ee5a49f93a6ad40e7726f5050
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Sep 12 11:51:07 2022 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri Sep 16 00:54:20 2022 +0200

    tdf#103829 ods export: don't output invalid office:string-value
    
    If the formatted (i.e. \t) string was different from
    the raw string (i.e. \x001 EE_FEATURE_TAB marker),
    then export was outputing office:string-value
    with IsInvalidChar \x001.
    
    The impact on import is that the cell wants to display
    this string-value, which is missing all of the "invalid char"
    stuff. So, just don't export a wrong string at all.
    
    Change-Id: Ib98e58d0c6e1186d199a4dcf294b56403b710f48
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139816
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 2d1ecb212ae6..b722137934fa 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1449,13 +1449,12 @@ void ScExportTest2::testTdf103829()
     ScDocShellRef xShell = loadDoc(u"tdf103829_textTab.", FORMAT_ODS);
     ScDocument& rDoc = xShell->GetDocument();
     CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0));
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0));
     CPPUNIT_ASSERT_EQUAL_MESSAGE("load a2", sA2, rDoc.GetString(0, 1, 0));
 
     xShell = saveAndReload(*xShell, FORMAT_ODS);
     ScDocument& rDoc2 = xShell->GetDocument();
     //CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1.getLength(), 
rDoc2.GetString(0, 0, 0).getLength());
-    //CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0));
     CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a2", sA2, rDoc2.GetString(0, 1, 0));
 }
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 3f88b3c88acb..579b04623aec 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3170,8 +3170,9 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 
nEqualCellCount)
             {
                 OUString sFormattedString(lcl_GetFormattedString(pDoc, 
aCell.maBaseCell, aCell.maCellAddress));
                 OUString sCellString = aCell.maBaseCell.getString(pDoc);
+                bool bExportValue = sCellString.indexOf('\x001') == -1;
                 
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
-                        sCellString, sFormattedString);
+                        sCellString, sFormattedString, bExportValue);
                 if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
                     
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
                             sCellString, sFormattedString, false, 
XML_NAMESPACE_CALC_EXT);

Reply via email to