sw/qa/extras/rtfimport/data/tdf167710.rtf         |    6 ++++++
 sw/qa/extras/rtfimport/rtfimport2.cxx             |    7 +++++++
 sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx |    3 +++
 3 files changed, 16 insertions(+)

New commits:
commit ee3d6b675620f32d01cbe3934e337cfc26a5519d
Author:     Michael Stahl <michael.st...@collabora.com>
AuthorDate: Thu Jul 31 18:18:52 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Aug 7 17:34:04 2025 +0200

    tdf#167710 writerfilter: RTF import: ignore text in  evtbl
    
    Only text in groups in  evtbl is relevant. Same goes for \stylesheet.
    
    (regression from commit 82e17dbb2a16c7653a163139f0eea51faa4d46b8)
    
    Change-Id: I70a97f7815e1f83b10be7cf12ee5abcd6b662a92
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188705
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@collabora.com>
    (cherry picked from commit b45ba94bf2d927d0306cdd0e885017735ae4b21e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188767
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/rtfimport/data/tdf167710.rtf 
b/sw/qa/extras/rtfimport/data/tdf167710.rtf
new file mode 100644
index 000000000000..02842a50fe37
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf167710.rtf
@@ -0,0 +1,6 @@
+{ tf1
+{\* evtbl Unknown;}
+\sectd
+\pard\plain
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport2.cxx 
b/sw/qa/extras/rtfimport/rtfimport2.cxx
index 04a41ed271ca..03813cfff385 100644
--- a/sw/qa/extras/rtfimport/rtfimport2.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport2.cxx
@@ -536,6 +536,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf91684)
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1337), 
getShape(1)->getSize().Height);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf167710)
+{
+    createSwDoc("tdf167710.rtf");
+    // problem was that text was erroneously imported
+    CPPUNIT_ASSERT(getParagraph(1)->getString().isEmpty());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testFlip)
 {
     createSwDoc("flip.rtf");
diff --git a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx 
b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx
index 8102c579fb80..c9dc19203670 100644
--- a/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx
+++ b/sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx
@@ -1532,6 +1532,9 @@ void RTFDocumentImpl::text(OUString& rString)
     switch (m_aStates.top().getDestination())
     {
         // Note: in stylesheet and revtbl groups are mandatory
+        case Destination::STYLESHEET:
+        case Destination::REVISIONTABLE:
+            break; // no text allowed here - ignore it
         case Destination::STYLEENTRY:
         case Destination::LISTNAME:
         case Destination::REVISIONENTRY:

Reply via email to