Bug 143722 - FILEOPEN DOCX Imported TOC Heading style replaced with Writers own on update
Summary: FILEOPEN DOCX Imported TOC Heading style replaced with Writers own on update
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.1.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.3.0 target:7.2.3
Keywords: bibisected, bisected, filter:docx, regression
Depends on:
Blocks: DOCX-TableofContents
  Show dependency treegraph
 
Reported: 2021-08-04 13:54 UTC by NISZ LibreOffice Team
Modified: 2021-10-05 09:53 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Screenshot of the original document side by side in Word and Writer (95.92 KB, image/png)
2021-08-04 13:54 UTC, NISZ LibreOffice Team
Details
Screenshot of the original document side by side in Word and Writer after updating the TOC (95.02 KB, image/png)
2021-08-04 13:55 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2021-08-04 13:54:41 UTC
Created attachment 174072 [details]
Screenshot of the original document side by side in Word and Writer

When a TOC in a DOCX file is opened its heading style is imported as “TOC Heading”. By default this has a blue text color and Calibri Light font in Word.
Upon updating the TOC this is replaced with Writers default heading style, Contents Heading which has black color and Liberation Sans font, changing the appearance of the TOC.

Steps to reproduce:
    1. Open a Word-made document with default TOC, such as attachment 143804 [details] from bug 118972
    2. Check that the TOC title (“Contents”) has the TOC Heading style, blue and Calibri Light font
    3. Right click the TOC, select Update Index

Actual results:
The TOC title gets Contents Heading style, black and Liberation Sans font.

Expected results:
The TOC Heading styles settings should be imported onto the Contents Heading style, so they would survive the TOC update unchanged.

LibreOffice details:
Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: ad1b12686da88bea57582df10fa85268ada209b8
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: CL

and in 5.1, but not yet in 5.0. The TOC Heading styles settings were imported correctly so the Contents Heading was blue, Calibri Light. 
The update of TOC did not change the style back then, because the title was imported incorrectly as a separate paragraph until 6.3.

Additional Information:
Bibisected using bibisect-win32-5.1 to:
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=70f3c595cae858e97616bf1f23adea8a75e42d4b 
author	 Miklos Vajna <vmiklos@collabora.co.uk>	2015-11-16 20:41:32 +0100
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2015-11-16 20:42:30 +0100

tdf#83300 DOCX import: 'TOC Heading' should not be 'keep with next' by default

Adding CC to: Miklos Vajna
Comment 1 NISZ LibreOffice Team 2021-08-04 13:55:01 UTC
Created attachment 174073 [details]
Screenshot of the original document side by side in Word and Writer after updating the TOC
Comment 2 Timur 2021-08-05 11:11:23 UTC
I wouldn't call it regression. In 5.0 ToC title wasn't recognized and it wasn't part of ToC, couln't be changed. 
So it seems just like another aspect of bug 118972.
Comment 3 raal 2021-08-07 16:50:35 UTC
Confirm Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 36efb384a66b6dd645e0ae80fd7df68370a9dc8b
CPU threads: 4; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded
Comment 4 Commit Notification 2021-08-19 12:52:39 UTC
Gabor Kelemen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e3f9170c03eb9121b0c244c0e2e60d15e6920deb

tdf#143722 DOCX import: map using default TOC heading style

It will be available in 7.3.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.
Comment 5 Commit Notification 2021-09-23 09:16:41 UTC
Gabor Kelemen committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/53bfea78bc218c84b7be5fe30e3146b7e90c8481

tdf#143722 DOCX import: map using default TOC heading style

It will be available in 7.2.3.

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.
Comment 6 NISZ LibreOffice Team 2021-10-05 09:53:48 UTC
Verified in:
Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: c2de581d1943df2d84f2b71817b6a8bee41f0217
CPU threads: 8; OS: Windows 10.0 Build 18363; UI render: Skia/Vulkan; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL