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

            Bug ID: 166511
           Summary: FILESAVE DOCX Word fails to open roundtripped document
                    (issue with non-unique ids)
           Product: LibreOffice
           Version: 24.2.0.3 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Keywords: bibisected, bisected
          Severity: normal
          Priority: medium
         Component: filters and storage
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: aron.bu...@gmail.com
            Blocks: 104442, 104522, 104528, 161381

Created attachment 200719
  --> https://bugs.documentfoundation.org/attachment.cgi?id=200719&action=edit
Sample DOCX

Open and save attached DOCX back to DOCX back in Writer, then try opening it in
Word.

=> Word fails to open the file cleanly. This happens with some Word versions
(eg. 2013), but not all.

When attempting repairs, Word points at word/footer3.xml, and when
investigating further, the problem is that there are multiple 'docPr' elements
with the same 'id' attribute:
- in word/footer2.xml: <wp:docPr id="6" name="Grafik 6" descr="" title=""/>
- in word/footer3.xml: <wp:docPr id="6" name="Textfeld 5"/>

Observed using LO 25.8.0.0.alpha0+ (736998ccef0bacdd2bbf038c98dacfbe654f1a4d) /
Windows.

The OOXML specification states this under docPr (Drawing Object Non-Visual
Properties) for the 'id' attribute:
"Specifies a unique identifier for the current DrawingML object within the
current document."

The original document only has one footer XML (word/footer1.xml), and the
exported file started having multiples since the following commit in 24.2:
https://git.libreoffice.org/core/commit/4b0fa253a4540f5461397815d290586f9ddabe61
https://cgit.freedesktop.org/libreoffice/core/commit/?id=4b0fa253a4540f5461397815d290586f9ddabe61
author          Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Tue Nov 28
13:46:21 2023 +0900
committer       Tomaž Vajngerl <qui...@gmail.com>       Fri Dec 01 08:26:38
2023 +0100

"tdf#136472 adjust ooxml import to handle first header/footer"

While the bug only comes up since the above commit, another change affected the
numbering of the 'id' attributes in 7.6/7.5.4:
https://git.libreoffice.org/core/commit/7460e4f4a7b15cc7984adf65bc17e3d580413224
https://cgit.freedesktop.org/libreoffice/core/commit/?id=7460e4f4a7b15cc7984adf65bc17e3d580413224
author          Tünde Tóth <toth.tu...@nisz.hu> Wed Mar 29 15:09:11 2023 +0200
committer       László Németh <nem...@numbertext.org>   Tue Apr 11 19:35:57
2023 +0200

"tdf#154469 DOCX export: fix hyperlink in group shape"

>From this commit, the following happens in a couple of places in
sw/source/filter/ww8/docxattributeoutput.cxx:
m_rExport.GetFilter().SetMaxDocId(m_anchorId + 1);
... (uses and increments m_anchorId)
m_anchorId = m_rExport.GetFilter().GetMaxDocId();

The change isn't explained in the commit, and doesn't seem directly related to
the fixed issue. However, cNvPr (Non-Visual Drawing Properties) also has an
'id' attribute, and both ids are identifiers for the current DrawingML object,
and are supposed to be unique in the document. Perhaps the change is supposed
to ensure that (m_anchorId becomes docPr's id, while MaxDocId is used as a
counter for the id of eg. a shape's cNvPr), but can cause a clash of ids within
docPr's.


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=104442
[Bug 104442] [META] OOXML shape (DrawingML and VML) related issues
https://bugs.documentfoundation.org/show_bug.cgi?id=104522
[Bug 104522] [META] DOCX (OOXML) header & footer-related issues
https://bugs.documentfoundation.org/show_bug.cgi?id=104528
[Bug 104528] [META] Saved DOCX files that MS Word can't open
https://bugs.documentfoundation.org/show_bug.cgi?id=161381
[Bug 161381] [META] Regressions from "tdf#136472 adjust ooxml import to handle
first header/footer"
-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to