https://bugs.documentfoundation.org/show_bug.cgi?id=172394

            Bug ID: 172394
           Summary: FILESAVE DOCX: a <w:del> nested in a <w:ins>
                    (inserted-then-deleted text) loses the <w:ins> on
                    export — round-trip drops the insertion redline
           Product: LibreOffice
           Version: 25.8.7.3 release
          Hardware: All
                OS: macOS (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 207400
  --> https://bugs.documentfoundation.org/attachment.cgi?id=207400&action=edit
Manual reproduction of bug in Word - added text "x" with tracked changes,
saved, and deleted the "x" and saved - initially opens fine in LibreOffice, but
change doesn't survive roundtrip from LibreOff

When a document contains text that was inserted and then deleted as tracked
changes — encoded by Microsoft Word as a `<w:del>` nested inside a `<w:ins>` —
LibreOffice **imports and displays it correctly** (the text shows as both
inserted and deleted), but **drops the `<w:ins>` on export**. After a single
open-and-save round-trip the text is left as a plain deletion: the insertion
redline, and its author, are silently lost.

This changes the meaning of the change: the original "inserted then deleted"
text is removed by both Accept All and Reject All, but after LibreOffice
re-saves it as a bare deletion, Reject All instead *keeps* the text (it now
reads as a deletion of pre-existing content).

The attached `manual-repro.docx` is generated by Microsoft Word (Track Changes:
type "x", then delete "x"). Its `word/document.xml` contains:

```xml
<w:ins w:id="0" w:author="Author"><w:del w:id="1" w:author="Author">
  <w:r w:rsidDel="000C71F7"><w:delText>x</w:delText></w:r>
</w:del></w:ins>
```

### Steps to Reproduce

1. Open the attached `manual-repro.docx` in LibreOffice Writer. The "x" shows
as **both inserted and deleted** (underline + strikethrough) — so Writer does
import the nested redline correctly.
2. File ▸ Save As ▸ Word 2007 (.docx) to a new file. (No Accept/Reject.)
3. Inspect `word/document.xml` inside the saved file (it is a ZIP).

Equivalent headless one-liner:

```
soffice --headless --convert-to "docx:MS Word 2007 XML" --outdir /tmp/out
manual-repro.docx
unzip -p /tmp/out/manual-repro.docx word/document.xml
```

### Actual Results

The `<w:ins>` is gone; only the deletion is written back:

```xml
<w:del w:id="0" w:author="Author"><w:r><w:delText>x</w:delText></w:r></w:del>
```

The text is now a plain deletion of "pre-existing" content — the insertion
redline and its author have been discarded.

### Expected Results

The nested insertion+deletion is preserved on export, as Microsoft Word writes
it (`<w:ins><w:del>…</w:del></w:ins>`), so a LibreOffice round-trip does not
lose the insertion redline. (Word's Accept All and Reject All both remove "x";
after LibreOffice's lossy export, Reject All would wrongly keep it.)

### Reproducible: Always

### User Profile Reset: No

### Additional Info

Build info copied from LibreOffice:
Version: 25.8.7.3 (AARCH64)
Build ID: 30742500f2d3eb4366ac312fa33d3dcabdb3eba5
CPU threads: 18; OS: macOS 26.4; UI render: Skia/Metal; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

(Observed on **LibreOffice 25.8.7.3**, build
`30742500f2d3eb4366ac312fa33d3dcabdb3eba5`, macOS, headless.)

Found while validating a separate OOXML track-changes engine against
LibreOffice as a reference implementation. Single-level redlines (a plain
`<w:ins>` or a plain `<w:del>`) round-trip correctly; only the **nested**
`<w:ins>`-wrapping-`<w:del>` construct loses the insertion on export.

## Attachment to this bug report / manual repro

- The attached file uses a single author named "Author" (Word's "Remove
personal information on save" anonymized it). Manual repro was: Track Changes
on, type "x"; save, delete "x"; save again. Then LibreOffice's export drops
reviewerA's insertion entirely.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to