sw/qa/extras/mailmerge/data/tdf35798.docx |binary sw/qa/extras/mailmerge/mailmerge.cxx | 17 +++++++++++++++++ sw/source/filter/ww8/ww8par.cxx | 2 -- sw/source/writerfilter/dmapper/DomainMapper.cxx | 1 - sw/source/writerfilter/filter/WriterFilter.cxx | 2 -- 5 files changed, 17 insertions(+), 5 deletions(-)
New commits: commit 04aec34b4448c63e7a18c569fe6bbc8067725ba2 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Jun 29 17:26:23 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Jun 29 19:30:09 2025 +0200 Revert "tdf#161264 don't hide paragraph with empty mail merge fields" This reverts commit dce68b5f9f286a8b6af42fcad1331d7e9bb07f4c. That commit tried to workaround tdf#156061, by basically disabling the feature that was intended to match an existing feature in MS Word. After commit ef3b11f811e1fd3852a22881d712afda03a0238f (tdf#156061: don't hide DB fields when not in mail merge, 2025-06-29), fixing tdf#156061 properly, Word documents should again have the feature enabled, as intended. I checked that tdf#159123 doesn't re-appear after this (at least on my system). Change-Id: I154e776fe56373fa021ff63e4fb3ac3c0815bb10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187151 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/qa/extras/mailmerge/data/tdf35798.docx b/sw/qa/extras/mailmerge/data/tdf35798.docx new file mode 100644 index 000000000000..2d5811bd0d9a Binary files /dev/null and b/sw/qa/extras/mailmerge/data/tdf35798.docx differ diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx index 7acf5f9bb50c..1df98ff75280 100644 --- a/sw/qa/extras/mailmerge/mailmerge.cxx +++ b/sw/qa/extras/mailmerge/mailmerge.cxx @@ -604,6 +604,23 @@ DECLARE_SHELL_MAILMERGE_TEST(testEmptyValuesNewFODT, "tdf35798-new.fodt", "5-wit getParagraphs(mxSwTextDocument->getText())); } +DECLARE_SHELL_MAILMERGE_TEST(testEmptyValuesDOCX, "tdf35798.docx", "5-with-blanks.ods", + "names") +{ + // DOCX - and any other Word format - must use the "hide empty DB fields" compatibility option. + // The feature was introduced to match Word's existing functionality in the first place. + executeMailMerge(); + CPPUNIT_ASSERT(mxSwTextDocument); + for (size_t i = 0; i < std::size(EmptyValuesNewData); ++i) + { + auto xPara = getParagraphOfText(i + 1, mxSwTextDocument->getText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("paragraph " + OString::number(i + 1)).getStr(), + EmptyValuesNewData[i], xPara->getString()); + } + CPPUNIT_ASSERT_EQUAL(static_cast<int>(std::size(EmptyValuesNewData)), + getParagraphs(mxSwTextDocument->getText())); +} + DECLARE_SHELL_MAILMERGE_TEST(testTdf118845, "tdf118845.fodt", "4_v01.ods", "Tabelle1") { executeMailMerge(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 3e93f797c290..fd595aa3499f 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1878,8 +1878,6 @@ void SwWW8ImplReader::ImportDop() DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA, true); m_rDoc.getIDocumentSettingAccess().set( DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND, true); - m_rDoc.getIDocumentSettingAccess().set( - DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA, false); // tdf#155229 calculate minimum row height including horizontal border width m_rDoc.getIDocumentSettingAccess().set( DocumentSettingId::MIN_ROW_HEIGHT_INCL_BORDER, true); diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index b511e485d0b4..ee93d502e234 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -150,7 +150,6 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon m_pImpl->SetDocumentSettingsProperty(u"NoNumberingShowFollowBy"_ustr, uno::Any(true)); //paint background frames after header/footer when anchored in body m_pImpl->SetDocumentSettingsProperty(u"PaintHellOverHeaderFooter"_ustr,uno::Any(true)); - m_pImpl->SetDocumentSettingsProperty(u"EmptyDbFieldHidesPara"_ustr,uno::Any(false)); m_pImpl->SetDocumentSettingsProperty(u"IgnoreTabsAndBlanksForLineCalculation"_ustr,uno::Any(true)); // calculate table row height with 'atLeast' including horizontal border width m_pImpl->SetDocumentSettingsProperty(u"MinRowHeightInclBorder"_ustr,uno::Any(true)); diff --git a/sw/source/writerfilter/filter/WriterFilter.cxx b/sw/source/writerfilter/filter/WriterFilter.cxx index 7c93a79b0163..17883d5d8b40 100644 --- a/sw/source/writerfilter/filter/WriterFilter.cxx +++ b/sw/source/writerfilter/filter/WriterFilter.cxx @@ -317,8 +317,6 @@ void WriterFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDo xSettings->setPropertyValue(u"IgnoreTabsAndBlanksForLineCalculation"_ustr, uno::Any(true)); xSettings->setPropertyValue(u"InvertBorderSpacing"_ustr, uno::Any(true)); xSettings->setPropertyValue(u"CollapseEmptyCellPara"_ustr, uno::Any(true)); - xSettings->setPropertyValue(u"EmptyDbFieldHidesPara"_ustr, uno::Any(false)); - // tdf#142404 TabOverSpacing (new for compatibilityMode15/Word2013+) is a subset of TabOverMargin // (which applied to DOCX <= compatibilityMode14). // TabOverMargin looks at tabs beyond the normal text area,