sw/source/filter/ww8/docxattributeoutput.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
New commits: commit 0c477a65b3e49b7fd0eeeb0eaf200d811918032f Author: Aron Budea <aron.bu...@collabora.com> AuthorDate: Thu May 15 12:03:58 2025 +0930 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu May 22 05:19:45 2025 +0200 sw filter: don't write empty OOXML docPr title/description Change-Id: I4cfeec04dc32ab4aded69f5f99046f8a1cf027a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185337 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 2a6500dd14af..57bf1dee0cb7 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5354,17 +5354,21 @@ static rtl::Reference<::sax_fastparser::FastAttributeList> CreateDocPrAttrList( pAttrs->add(XML_name, rName); if (rExport.GetFilter().getVersion() != oox::core::ECMA_376_1ST_EDITION) { - pAttrs->add(XML_descr, rDescription); - pAttrs->add(XML_title, rTitle); + if (!rDescription.empty()) + pAttrs->add(XML_descr, rDescription); + if (!rTitle.empty()) + pAttrs->add(XML_title, rTitle); } else { // tdf#148952 no title attribute, merge it into descr - OUString const value(rTitle.empty() - ? OUString(rDescription) - : rDescription.empty() - ? OUString(rTitle) - : OUString::Concat(rTitle) + " " + rDescription); - pAttrs->add(XML_descr, value); + if (!rTitle.empty() || !rDescription.empty()) + { + OUString const value(rTitle.empty() ? OUString(rDescription) + : rDescription.empty() + ? OUString(rTitle) + : OUString::Concat(rTitle) + " " + rDescription); + pAttrs->add(XML_descr, value); + } } return pAttrs; }