Bug 166786 - Cross-reference and numbering corruption when exporting DOCX to PDF: LibreOffice reinterprets structured clause references into an expanded and incorrect hierarchical format, leading to inaccurate rendering in both the UI and exported PDF
Summary: Cross-reference and numbering corruption when exporting DOCX to PDF: LibreOff...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.2.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: PDF-Export Fields-Cross-Reference
  Show dependency treegraph
 
Reported: 2025-05-29 21:07 UTC by Hwa Chuang
Modified: 2025-08-12 19:12 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Document to reproduce issue. (101.93 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-05-29 21:08 UTC, Hwa Chuang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hwa Chuang 2025-05-29 21:07:57 UTC
Description:
When a Microsoft Word .docx document with properly structured numbering and cross-references is opened and then exported to PDF using LibreOffice, the cross-reference text and underlying list numbering structure are incorrectly reinterpreted and expanded.

For example, a clause that reads:

“Additional Fees has the meaning given in clause 3(a)(i) of this variation agreement.”

is displayed and exported by LibreOffice as:

“Additional Fees has the meaning given in clause 3.1.1.1(a)(i) of this variation agreement.”

This issue does not occur in Microsoft Word, which preserves the reference as written. LibreOffice appears to alter the internal representation of the list structure, causing downstream cross-references to adopt this misinterpreted format.

Steps to Reproduce:
1.Open the attached file claause.docx in LibreOffice.
  a. Observe correct cross-reference: “Additional Fees has the meaning given in  clause 3(a)(i)”

2.Export to PDF using File → Export As → Export as PDF

3.Open resulting PDF (e.g., claause.pdf).
  a.Observe incorrect rendering: “ Additional Fees has the meaning given in clause 3.1.1.1(a)(i)”

4.Return to LibreOffice Writer UI — the same text is now altered in the document itself

Actual Results:
After a document exported from LibreOffice, both LibreOffice Writer UI and exported PDF file show:

"Additional Fees has the meaning given in clause 3.1.1.1(a)(i)"

Expected Results:
LibreOffice should preserve both the logical and visual format of cross-references and list numbering as seen in the original DOCX, particularly when:

1.The source document’s numbering is intentionally shallow (e.g., 3(a)(i)).

2.The cross-reference string refers to that structure exactly.

In both the editing interface and exported PDF, the string should remain:
“clause 3(a)(i)”


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.2.4.1 (X86_64) / LibreOffice Community
Build ID: 09303ce8b49f86f106fccd32b1324662053027cc
CPU threads: 6; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 1 Hwa Chuang 2025-05-29 21:08:48 UTC
Created attachment 201034 [details]
Document to reproduce issue.
Comment 2 Saburo 2025-05-31 10:01:26 UTC
I confirmed that it reproduces.
The fields will be updated when you display the print dialog or export to PDF.

In the document, “3.Variation” is at outline level 1, while “(a)” is at level 5 and “(i)” is at level 6.
I don't think LibreOffice is wrong, but to replicate Word they might need to add an option to omit unused outline levels.

Version: 25.2.4.1 (X86_64) / LibreOffice Community
Build ID: 09303ce8b49f86f106fccd32b1324662053027cc
CPU threads: 12; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL threaded