summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2022-04-07 09:28:42 +0200
committerJustin Luth <jluth@mail.com>2022-04-18 05:18:48 +0200
commitc136249982345b205da83d1907e21da0c7bab7dd (patch)
treeb097e205c824c7dde57f66db692e4f5a2c87454c /sw
parentf8e11c6480ff0005715b989a6d4e2e10a3816cf6 (diff)
tdf#148380 docx export: use content of unknown fields, not name
This used to be GetCntnt, but then out of the blue in a huge squashed commit, it changed to GetFieldName. So I assume that was just debugging code that got accidentally committed. It just doesn't make any sense to export the field name as the plain text content instead of the field's value. commit ed40f62e64564d2b22c9285cfdc6778aeac8fd68 Author: Michael Meeks on Mon Mar 14 16:51:14 2011 +0000 Merge commit 'ooo/DEV300_m101' into integration/dev300_m101 NOTE: DOC also does a .replace(0x0A, 0x0B), //replace LF 0x0A with VT 0x0B //#i19604# convert hard line breaks inside fields to word equivalent After taking care of SAVEDATE, PRINTDATE, I tested this with assert(rInfos.pField->GetFieldName() == "Sender"); and found no other examples. Change-Id: Ie24b8c176fe6df4015be221c87aa249fe9b8ce92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132666 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx5
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
2 files changed, 5 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index c4bcd2b23da1..2cf70462cbe9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -319,9 +319,12 @@ CPPUNIT_TEST_FIXTURE(Test, testOldComplexMergeTableInTable)
CPPUNIT_TEST_FIXTURE(Test, testHyperlinkContainingPlaceholderField)
{
- loadAndSave("hyperlink-field.odt");
+ loadAndReload("hyperlink-field.odt");
CPPUNIT_ASSERT_EQUAL(1, getShapes());
parseExport("word/document.xml");
+
+ // tdf#148380 output unknown field's contents("") instead of field name("Sender" aka e-mail)
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getParagraph(1)->getString().indexOf("Sender"));
}
CPPUNIT_TEST_FIXTURE(Test, testTablePreferredWidth)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6daca466f1ff..88df3b95f46d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2403,7 +2403,7 @@ void DocxAttributeOutput::StartField_Impl( const SwTextNode* pNode, sal_Int32 nP
if ( rInfos.pField && rInfos.eType == ww::eUNKNOWN )
{
// Expand unsupported fields
- RunText( rInfos.pField->GetFieldName() );
+ RunText(rInfos.pField->ExpandField(/*bCached=*/true, nullptr));
return;
}
else if ( rInfos.eType == ww::eFORMDATE )