Bug 125150

Summary: Table of Contents disappears if empty when saving as docx
Product: LibreOffice Reporter: arrowdodger <arrowdodger1>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: minor CC: 79045_79045, libreoffice
Priority: low Keywords: dataLoss, filter:docx
Version: Inherited From OOo   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=121561
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 104524    
Attachments: Example file to reproduce the problem

Description arrowdodger 2019-05-07 06:59:44 UTC
Description:
Reloading a .docx file with empty Table of Contents makes it go away and introduce a new, stange-named style.

Steps to Reproduce:
1. Create empty document
2. "Insert" -> "Table of Contents and Index" -> "Table of Contents, Index or Bibliography"
3. In the dialogue press "OK" to create a Table of Contents.
4. Save the file as "Word 2007-2019 (.docx)".
5. Close the document and open again.

Actual Results:
1. The ToC is gone.
2. New "TOA Heading" style is added to the list of ToC styles.

Expected Results:
1. ToC is still there, despite being empty.
2. New style is not created, but default "Contents Heading" style us used.


Reproducible: Always


User Profile Reset: No



Additional Info:
Expected results can be observed when saving to .odt instead of .docx.
Comment 1 Roman Kuznetsov 2019-05-07 08:08:29 UTC
repro in

Version: 6.3.0.0.alpha0+
Build ID: d6e8e41c22023bc15cc4c9659b33c1cc3d6edb75
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2019-05-05_23:45:44
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded
Comment 2 Timur 2019-05-09 09:34:36 UTC
Looks like ToC never was saved OK so I'll put Inherited. 
New "TOA Heading" style was added later.
But this is special case so I'll mark minor.
Comment 3 NISZ LibreOffice Team 2020-11-30 10:18:36 UTC
Created attachment 167676 [details]
Example file to reproduce the problem

Still present in:

Version: 7.2.0.0.alpha0+ (x64)
Build ID: f7e2f5bca938aa916830e07895d2da6820282055
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: CL

Adding a new paragraph with Heading 1 style and updating the TOC in odt puts the new paragraph into the TOC but this is not possible if this file was saved as docx.
Comment 4 QA Administrators 2022-12-01 03:46:46 UTC Comment hidden (obsolete)
Comment 5 arrowdodger 2022-12-04 18:27:36 UTC
Still present in 7.4.3.2