sc/qa/unit/data/ods/tdf108244.ods      |binary
 sc/qa/unit/subsequent_export_test4.cxx |   10 ++++++++++
 sc/source/filter/xml/xmlexprt.cxx      |    7 ++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit beeb2acc1c6ce3cf9b076b8e164fdbe79a0a7b51
Author:     Markus Mohrhard <markus.mohrh...@googlemail.com>
AuthorDate: Wed Aug 13 04:05:22 2025 +0800
Commit:     Markus Mohrhard <markus.mohrh...@googlemail.com>
CommitDate: Wed Aug 13 02:36:00 2025 +0200

    tdf#108244: generate note caption always at the beginning of the export
    
    Change-Id: I160f57cf43227e7a432536134da242a4b3053d4e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189453
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
    Tested-by: Jenkins

diff --git a/sc/qa/unit/data/ods/tdf108244.ods 
b/sc/qa/unit/data/ods/tdf108244.ods
new file mode 100644
index 000000000000..7e6e3a06eb56
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf108244.ods differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index d9551b045794..0a5103ff4466 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -2212,6 +2212,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf166939_1)
     assertXPath(pXmlDoc, "//table:table/table:table-row[2]", "style-name", 
u"r_2");
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf108244)
+{
+    createScDoc("ods/tdf108244.ods");
+    save(u"OpenDocument Spreadsheet Flat XML"_ustr);
+    xmlDocUniquePtr pXmlDoc = parseExportedFile();
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    CPPUNIT_ASSERT_EQUAL(u"1"_ustr, getXPathContent(pXmlDoc, 
"count(//office:annotation)"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index ffe0b364338d..dfe5f738eee0 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -5404,11 +5404,12 @@ void ScXMLExport::IncrementProgressBar(bool bFlush, 
sal_Int32 nInc)
 
 ErrCode ScXMLExport::exportDoc( enum XMLTokenEnum eClass )
 {
+    ScDocument* pDoc = GetDocument();
     if( getExportFlags() & 
(SvXMLExportFlags::FONTDECLS|SvXMLExportFlags::STYLES|
                              
SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT) )
     {
         uno::Reference< frame::XModel > xModel = GetModel();
-        if (ScDocument* pDoc = GetDocument())
+        if (pDoc)
         {
             // if source doc was Excel then
             auto pFoundShell = 
comphelper::getFromUnoTunnel<SfxObjectShell>(xModel);
@@ -5448,6 +5449,10 @@ ErrCode ScXMLExport::exportDoc( enum XMLTokenEnum eClass 
)
             }
         }
     }
+    if (pDoc)
+    {
+        pDoc->CreateAllNoteCaptions();
+    }
     return SvXMLExport::exportDoc( eClass );
 }
 

Reply via email to