Bug 153664

Summary: FILESAVE DOCX Table of Figures entry saved with incorrect paragraph style
Product: LibreOffice Reporter: Gabor Kelemen (allotropia) <kelemeng>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: stephane.guillou
Priority: medium Keywords: filter:docx
Version: 4.0.0.3 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=143726
https://bugs.documentfoundation.org/show_bug.cgi?id=153659
Whiteboard: target:7.6.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 104524    
Attachments: Example file from Writer with Table of Figures
The example file saved to DOCX
The original file in Writer and the exported one in Word 2016

Description Gabor Kelemen (allotropia) 2023-02-16 10:21:30 UTC
Created attachment 185402 [details]
Example file from Writer with Table of Figures

This is related to bug 153659, but for save.

When attachment 184745 [details] is opened in Writer and the ToF is updated, its entries get the built-in "Figure Index 1" style.
When the document is saved, this paragraph style is retained correctly.
However opening it in Word, and updating the index, it gets replaced by the Word-default Table of Figures style, which has a 0 spacing after, so the layout changes again.
This also happens with a Writer-made file, when the font and size were customized for the built-in "Figure Index 1" style.

1. Open attached file
2. Save the file as DOCX, open it in Word
3. Notice the ToF still has the Figure Index 1 style, Lucida Calligraphy font, 15 pt size.
4. Right click the Table of Figures, Update Index
-> Now the style is reset to Table of Figures, Liberation Serif font, 12 pt

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 14a36ad49518bcb5b606b0f1640e3ca56b636e89
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded
And way back to 4.0, 3.6 generated an invalid file.

This is similar to bug 143726
Comment 1 Gabor Kelemen (allotropia) 2023-02-16 10:21:58 UTC
Created attachment 185403 [details]
The example file saved to DOCX
Comment 2 Gabor Kelemen (allotropia) 2023-02-16 10:23:39 UTC
Created attachment 185404 [details]
The original file in Writer and the exported one in Word 2016
Comment 3 Stéphane Guillou (stragu) 2023-03-02 08:28:58 UTC
Reproduced with:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 508a610808631bc292a8daf4f78bd8726b2d56be
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

And:

Microsoft® Word for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20196) 64-bit
Comment 4 Commit Notification 2023-03-22 20:05:17 UTC
Gabor Kelemen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/667f5f87dee072f6737ee6b6491ed53b7cf154a7

tdf#153664 Export correct Table of Figures paragraph style

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.