Bug 170438 - FILESAVE DOCX: corrupt document reported by MS Word if SDT dropdown displayText is empty
Summary: FILESAVE DOCX: corrupt document reported by MS Word if SDT dropdown displayTe...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3 all versions
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:26.8.0 target:26.2.1
Keywords: bisected, filter:docx
Depends on:
Blocks: DOCX-Corrupted
  Show dependency treegraph
 
Reported: 2026-01-22 16:31 UTC by Justin L
Modified: 2026-01-26 16:57 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
forum-mso-en4-401306.docx: example document (51.94 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2026-01-22 16:31 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2026-01-22 16:31:11 UTC
Created attachment 205136 [details]
forum-mso-en4-401306.docx: example document

Although a <w:listItem w:value=""/> is OK, a <w:listItem w:displayText=""/> is considered to be a corrupt document.

Steps to reproduce:
-open forum-mso-en4-401306.docx in LO and resave it
-now try to open in Microsoft Word

In the original document, this is a blockSDT containing the table cell.
<w:dropDownList>
  <w:listItem w:displayText="Choose activity type" w:value=""/>
  <w:listItem w:displayText="Ops" w:value="37982124-..."/>
  <w:listItem w:displayText="Train" w:value="E1752CF3-..."/>
</w:dropDownList>

In this case, we are not currently importing the SDT as a content control, but rather as a native SwXTextField SwServiceType::FieldTypeDropdown. These apparently don't have a separate "display" and "value", so only the array of values are being passed as a list - where the first item is an empty value. (However, since the 'default text' is 'Choose activity type', and that was not one of the list items, we added it as a fourth item.)
Comment 1 Commit Notification 2026-01-23 18:17:10 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/270fe90efbb275a670d063303e395ed88ea4731d

tdf#170438 docx export: never export listItem with empty displayText

It will be available in 26.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 2 Commit Notification 2026-01-26 16:57:14 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-26-2":

https://git.libreoffice.org/core/commit/f5e64db444b5cd5cdb53b2744bd52d441a0169b3

tdf#170438 docx export: never export listItem with empty displayText

It will be available in 26.2.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.