Bug 125150 - Table of Contents disappears if empty when saving as docx
Summary: Table of Contents disappears if empty when saving as docx
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: low minor
Assignee: Not Assigned
Keywords: dataLoss, filter:docx
Depends on:
Blocks: DOCX-TableofContents
  Show dependency treegraph
Reported: 2019-05-07 06:59 UTC by arrowdodger
Modified: 2022-12-04 18:27 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

Example file to reproduce the problem (9.54 KB, application/vnd.oasis.opendocument.text)
2020-11-30 10:18 UTC, NISZ LibreOffice Team

Note You need to log in before you can comment on or make changes to this bug.
Description arrowdodger 2019-05-07 06:59:44 UTC
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

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: (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