desktop/source/lib/init.cxx            |    2 +-
 sc/qa/unit/subsequent_export_test2.cxx |    6 ++++++
 sc/source/filter/excel/excdoc.cxx      |    5 +++++
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit e0cde34668e0d3c8181eceb6f1e0153a77cf1982
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Dec 10 16:31:34 2025 -0500
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Dec 16 16:48:36 2025 +0100

    tdf#165180 xlsx export: lowestEdited=4 for ECMA 376 1st ed.
    
    If we don't provide lowestEdited=4
    when saving as an Excel 2007 spreadsheet,
    then LO (and Excel) will treat it as a 2010 document
    the next time it is loaded.
    
    make CppunitTest_sc_subsequent_export_test2 \
        CPPUNIT_TEST_NAME=testTdf114969XLSX
    
    Change-Id: I7146c083dbc4eb451ce26cf1e282f63e6859c1b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195180
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195528

diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index f0cf473f2c04..0ca3d733b129 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1111,6 +1111,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf114969XLSX)
     CPPUNIT_ASSERT(pDoc);
     assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[1]", "location", 
u"'1.1.1.1'!C1");
     assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", 
u"'1.1.1.1'!C2");
+
+    // tdf#165180: should be recognizable as a 2007 XLSX format when saved
+    save(TestFilter::XLSX_2007);
+    xmlDocUniquePtr pWorkbook = parseExport(u"xl/workbook.xml"_ustr);
+    // lowestEdited = 4 needs to be output in order to be detected as a 2007 
ECMA_376_1ST_EDITION
+    assertXPath(pWorkbook, "/x:workbook/x:fileVersion", "lowestEdited", u"4");
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf115192XLSX)
diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index fc794b00ab60..21e537baa28f 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -857,6 +857,11 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
         = sax_fastparser::FastSerializerHelper::createAttrList();
     pAttrListFileVersion->add(XML_appName, "Calc");
     std::optional<sal_Int16> oLow = 
GetExtDocOptions().GetDocSettings().moLowestEdited;
+    if (rStrm.getVersion() == oox::core::ECMA_376_1ST_EDITION
+        && (!oLow.has_value() || oLow > 4))
+    {
+        oLow = 4; // when saving as MS Excel 2007, set the corresponding 
lowestEdited-by version
+    }
     if (oLow.has_value())
         pAttrListFileVersion->add(XML_lowestEdited, OString::number(*oLow));
             // OOXTODO: XML_codeName
commit b5ca738c24a751187b15949a0de289a9f38193b1
Author:     Justin Luth <[email protected]>
AuthorDate: Sat Nov 29 16:40:18 2025 -0500
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Dec 16 16:48:32 2025 +0100

    tdf#165180 xlsx LOKit: prefer Excel 2010–365 Spreadsheet, not 2007
    
    A prior commit in this patchset
    clarified what "Calc Office Open XML" is targeted for.
    
    Probably it is time for us to intentionally target the 2010+ format...
    
    Change-Id: I58bffb393f82d2ea667cded8c0a198217fc93cc8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195033
    Reviewed-by: Justin Luth <[email protected]>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195525

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d65872ae8cbb..a1bebedb4607 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -356,7 +356,7 @@ constexpr ExtensionMap aCalcExtensionMap[] =
     { "xhtml", u"XHTML Calc File"_ustr },
     { "xls",   u"MS Excel 97"_ustr },
     { "xlsm",  u"Calc MS Excel 2007 VBA XML"_ustr },
-    { "xlsx",  u"Calc MS Excel 2007 XML"_ustr },
+    { "xlsx",  u"Calc Office Open XML"_ustr },
     { "png",   u"calc_png_Export"_ustr },
 };
 

Reply via email to