Bug 170516 - FILESAVE DOCX: corrupt document (sometimes) reported by MS Word when plainText Sdt contains drawing
Summary: FILESAVE DOCX: corrupt document (sometimes) reported by MS Word when plainTex...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bisected, filter:docx
Depends on:
Blocks: DOCX-Corrupted
  Show dependency treegraph
 
Reported: 2026-01-28 15:39 UTC by Justin L
Modified: 2026-01-28 15:39 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
forum-mso-en-16671.docx: example document (65.21 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2026-01-28 15:39 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-28 15:39:53 UTC
Created attachment 205228 [details]
forum-mso-en-16671.docx: example document

MS Word generally doesn't like complex content inside of a plainText content control. Although bug 165359 shows us that it IS possible to have graphics and shapes inside a plainText control, under some circumstances it can be reported as corrupt (where it is not corrupt if the control has the <w:text/> marker removed).

Steps to reproduce:
-open forum-mso-en-16671.docx in LO and resave it.
-open the resaved file in Microsoft Word  (file reported as broken)

I bisected this back to 7.6 commit c804c5354855188b5a37219cfe11dc079dc235f4
Author: Miklos Vajna on Fri Mar 10 17:32:07 2023 +0000
    sw content control: fix lost properties on copy&paste
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148613

However, his commit just restored the missing SdtPr values (including the w:text), so it just exposed an existing weakness.

In this case, the floating graphics are anchored at the start of the paragraph. Normally the code writes the graphics first (1), in a separate run. But in this case, because this is all in a floating table, that code path was not followed, and the SDT was started before the graphics were written out.

(1) flies processed first/text postponed with
commit 80fd9fb7209cfd5c0622ee99d59e42e6db32f021
Author:     Umesh Kadam on Thu May 22 02:31:53 2014 -0500
    fdo#78333 : SdtContent and a Shape overlapping causes corruption
    Reviewed-on: https://gerrit.libreoffice.org/9374