Bug 47252

Summary: FILESAVE: cross-references do not export well to DOCX file
Product: LibreOffice Reporter: Alan Krueger <alan>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: bfo.bugmail, crtapia, sasha.libreoffice, stgohi-lobugs
Priority: medium Keywords: filter:docx
Version: 3.4.4 release   
Hardware: Other   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=100474
Whiteboard: BSA
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 104520    

Description Alan Krueger 2012-03-12 14:30:46 UTC
Added cross-reference links in an ODT file to numbered paragraphs earlier in the document using "Reference".  In Writer, this shows up as the name of the paragraph being referenced.  These look fine until exported to DOCX.

Opening the DOCX file back in Writer shows the reference text as __RefNumPara__173_1178930885.  Typing around these refs in Writer appears to fix them.

Looking at the DOCX archive, word/document.xml appears to actually have the reference ID as text:

<w:r><w:rPr/><w:fldChar w:fldCharType="begin"/></w:r>
<w:r><w:instrText> REF __RefNumPara__173_1178930885 \h </w:instrText></w:r>
<w:r><w:fldChar w:fldCharType="separate"/></w:r>
<w:r><w:t xml:space="preserve"> __RefNumPara__173_1178930885</w:t></w:r>  <!-- here -->
<w:r><w:fldChar w:fldCharType="end"/></w:r>
Comment 1 sasha.libreoffice 2012-06-05 02:08:53 UTC
Thanks for bugreport. Slightly resembles this Bug 46025
Comment 2 bfoman (inactive) 2012-08-09 12:01:48 UTC
Checked with:
LO 3.5.5.3 
Build ID: own W7 debug build
Windows 7 Professional SP1 64 bit

(In reply to comment #0)
> Opening the DOCX file back in Writer shows the reference text as
> __RefNumPara__173_1178930885.  Typing around these refs in Writer appears to
> fix them.

Could not reproduce.
Comment 3 Florian Reisinger 2013-04-08 15:24:35 UTC
Confimed with 3.6.6.2 4.0.1.2 and master:

Steps I used to reproduce:
1) Insert image
2) Add caption to the image
3) Try to cross reference
4) Save as .docx
5) Open in Word 2010 or in LibO and see it didn't work (The result is not exactly the same, but the problem)
Comment 4 A (Andy) 2015-02-26 19:52:21 UTC
Reproducible with LO 4.4.1.2, Win 8.1

Note: In addition, the image is displaced and the caption is faulty changed.
Comment 5 tommy27 2016-04-16 07:24:50 UTC Comment hidden (obsolete)
Comment 6 Frederic Parrenin 2016-06-09 20:45:17 UTC
I confirm this bug is still present in 5.0.6.
Cross-reference to a Figure number result in the word "Illustration' being inserted in the .docx file.
The export to .doc is OK, though.
Comment 7 Cristóbal Tapia 2017-07-05 08:32:48 UTC
I can also confirm that this problem is still present in LibreOffice 5.3.1

Any cross-reference inserted is not maintained when saving to a *.docx file. Interestingly, opening a *.docx file with references created in MS Word does show the references correctly and are even maintained after saving the file as *.docx again. But any cross-reference created in LibreOffice just get replaced by the name of the type of object being referenced (e.g. Table, Figure, ...). 
So there seems to be a problem within the process of creating the references.
Comment 8 Lars Jødal 2017-11-11 16:38:28 UTC

*** This bug has been marked as a duplicate of bug 42346 ***
Comment 9 Lars Jødal 2017-11-11 16:40:54 UTC
The good news is that the bug is actually in the process of being fixed, see the latest comments on bug 42346.