diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-11-22 14:30:08 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-11-22 19:36:37 +0100 |
commit | 100c914d44ae8f362924fe567d7d41d0033ae8ad (patch) | |
tree | 7b598ced8fdcf9c662c6c432c6a954aa383e82b8 /sw/source/filter | |
parent | b71303fe1b06c1711ad80e5a0269d41ccaaad8e1 (diff) |
DOCX filter: fix <w:id> creating both grab-bag and content control for <w:sdt>
Exporting the DOCX bugdoc back to DOCX resulted in a document that can't
be opened in Word.
Examining the output, the problem is that the document had 2 inline
<w:sdt> elements with <w:id>, and we mapped such <w:sdt> elements to
both grab-bags and content controls, leading to duplicate <w:sdt>
elements on export. This is schema-valid, but it goes against the
intention of the spec and Word can't open it.
The initial fix was just a writerfilter/ tweak to avoid grab-bagging
<w:id> for inline <w:sdt>, but CppunitTest_sw_ooxmlexport4's
testSimpleSdts points out that in other cases we already require
preserving <w:id>. Fix the problem by storing <w:id> in the content
control, which is essentially a subset of
<https://gerrit.libreoffice.org/c/core/+/142818>.
Thanks to Justin Luth! - he prototyped the DOCX filter for <w:id>.
Change-Id: I9f002b770049ce8be30253d0b39410d9a58981dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143117
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 26ed9d57a95b..e245b22caf4a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2373,6 +2373,12 @@ void DocxAttributeOutput::WriteContentControlStart() m_pContentControl->GetTag()); } + if (m_pContentControl->GetId()) + { + m_pSerializer->singleElementNS(XML_w, XML_id, FSNS(XML_w, XML_val), + OString::number(m_pContentControl->GetId())); + } + if (m_pContentControl->GetShowingPlaceHolder()) { m_pSerializer->singleElementNS(XML_w, XML_showingPlcHdr); |