Bug 137363 - FILEOPEN/FILESAVE: DOCX Style using numbered MultiLevel List loses level (IN MS WORD)
Summary: FILEOPEN/FILESAVE: DOCX Style using numbered MultiLevel List loses level (IN ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Miklos Vajna
URL:
Whiteboard: target:7.3.0
Keywords: filter:docx
Depends on:
Blocks: DOCX-Styles
  Show dependency treegraph
 
Reported: 2020-10-09 07:30 UTC by Michelle
Modified: 2021-09-13 15:58 UTC (History)
6 users (show)

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


Attachments
File which causes the bug (12.99 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-10-09 07:30 UTC, Michelle
Details
Comparison of resulting files in MS Word 2019 (68.62 KB, image/png)
2020-10-09 07:31 UTC, Michelle
Details
Screenshot of the original document side by side in Word 2013 and Writer (73.82 KB, image/png)
2020-12-08 07:35 UTC, NISZ LibreOffice Team
Details
numStyleLevel.odt: I don't think LO has the ability to set level via a style (10.70 KB, application/vnd.oasis.opendocument.text)
2020-12-08 10:03 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michelle 2020-10-09 07:30:01 UTC
Description:
Docx files which contain styles using different levels of a multilevel list will lose the number part of the style (if the multilevel list level is not 1) when opened in LO and saved as docx. See example document and comparison image.

Steps to Reproduce:
1. Open provided sample document in LibreOffice
2. Save as docx
3. Compare results in Word/LO

Actual Results:
In Word: Applying style2/style3 does not include the number part
In LO: Applying style2/style3 applies the styles with list level 1 and not list level 2 and 3 respectively

Expected Results:
Styles should preserve the associated multilevel list level.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Tested in latest release:

Version: 7.0.2.2 (x64)
Build ID: 8349ace3c3162073abd90d81fd06dcfb6b36b994
CPU threads: 16; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: en-AU (en_AU); UI: en-US
Calc: CL
Comment 1 Michelle 2020-10-09 07:30:34 UTC
Created attachment 166225 [details]
File which causes the bug
Comment 2 Michelle 2020-10-09 07:31:12 UTC
Created attachment 166226 [details]
Comparison of resulting files in MS Word 2019
Comment 3 Xisco Faulí 2020-10-12 17:48:15 UTC Comment hidden (obsolete)
Comment 4 Michelle 2020-10-14 02:49:22 UTC
(In reply to Xisco Faulí from comment #3)
> I can't reproduce it in
> 
> Version: 7.1.0.0.alpha0+
> Build ID: a9976a958b2857e308c6598532151878615bfd9f
> CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
> Locale: en-US (en_US.UTF-8); UI: en-US
> Calc: threaded
> 
> Please attach a screenshot showing how the problem looks in LibreOffice

I was able to reproduce the issue in 7.1.0.0.alpha0+.

The files appear the same in libre office. The issue is that if I apply style2 or style3 in libre office, it applies the style with style1's numbering level (level 1) instead of applying numbering level 2 and level 3 respectively.

After saving the original file as docx from LO the numbering part of the style is lost for both Style2 and Style3.
Comment 5 QA Administrators 2020-10-14 04:31:41 UTC Comment hidden (obsolete)
Comment 6 NISZ LibreOffice Team 2020-12-08 07:35:14 UTC
Created attachment 167927 [details]
Screenshot of the original document side by side in Word 2013 and Writer

It looks like a fileopen issue to begin with:
- Open attached file, add 3 new paragraphs
- Format them with Style1-3

In Word they get numbering levels 1-2-3, in Writer they all get numbering level 1.
Comment 7 NISZ LibreOffice Team 2020-12-08 07:48:41 UTC
Confirming with:

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

Does not seem to be a regression, in older versions before 7.0 new paragraphs consistently did not even get the numbering at level 1.
Comment 8 Michelle 2020-12-08 07:59:44 UTC
In the docx xml there is a element under the style definition to denote the list level to use:
w:ilvl

There is an equivalent in the odt spec:
style:list-level

But this element does not seem to register in LO?

See also related bug report:
https://bugs.documentfoundation.org/show_bug.cgi?id=62032
Comment 9 NISZ LibreOffice Team 2020-12-08 08:26:18 UTC
Current behavior seems to have started with:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=35fc5ef0a759884b24ed8b83cd05702a0fab64cc

author	Justin Luth <justin.luth@collabora.com>	2020-04-11 12:05:03 +0300
committer	Miklos Vajna <vmiklos@collabora.com>	2020-04-14 09:46:52 +0200

tdf#131321 writerfilter: ApplyNumberingStyleNameToParaStyles()
Comment 10 Justin L 2020-12-08 10:03:24 UTC
Created attachment 167935 [details]
numStyleLevel.odt: I don't think LO has the ability to set level via a style

Ahh - good. This is not marked as a regression.
Also good that this does not adversely affect any existing formatting. It only affects USING the style in further editing.

So, as I see it, before my commit (identified in comment 9) Style1/2/3 was not applying ANY numbering at all. Now it is correctly applying numbering, but still not at the correct level.

I tried to see if LO can do that natively. It does not appear to be able to do that. I included a unit test showing my attempt.

So probably the only (simple?) task would be to round-trip the level in the style.
Comment 11 Timur 2020-12-08 15:52:13 UTC Comment hidden (obsolete)
Comment 12 Justin L 2021-06-29 06:19:37 UTC
(In reply to Michelle from comment #4)
> The issue is that if I apply style2 or style3 in libre office, 
> it applies the style with style1's numbering level (level 1) 
> instead of applying numbering level 2 and level 3 respectively.
Yes - definitely LibreOffice is NOT able to do this. The ONLY paragraph styles that can apply a listLevel are the ones defined by Tools - Chapter Numbering. This is a HUGE limitation imposed by LibreOffice.

This bug should be revisited after bug 141964 is fixed. It MIGHT have chosen this numId to be the one applied to Chapter Numbering.

There is no point in reviewing this for DOC format. That ONLY imports Heading X styles as Chapter Numbering. (Nor would I want to change that since Chapter Numbering is absolute disaster for interoperability.)

// LibreOffice is not very flexible with "Outline Numbering"
// (aka "Outline" numbering style). Only ONE numbering rule ("Outline")
// can be associated with a style-assigned-listLevel,
// and no other style is able to inherit these numId/nLvl settings - only
// text nodes can. So listLevel only exists in paragraph properties
// EXCEPT for up to ten styles that have been assigned to one of these
// special Chapter Numbering listlevels (by default Heading 1-10).


This is basically a duplicate of bug 62032, but I'll leave it separate in case anyone wants to grab-bag the listlevel setting and round-trip it for the benefit of Word.
Comment 13 Justin L 2021-07-06 05:41:39 UTC
(In reply to Justin L from comment #12)
> This bug should be revisited after bug 141964 is fixed. It MIGHT have chosen
> this numId to be the one applied to Chapter Numbering.
Nope. Styles 1-3 are not set with an equivalent OutlineLevel, so they won't (and shouldn't be) be selected as chapter numbering.
Comment 14 Miklos Vajna 2021-08-26 10:08:50 UTC
A minimal scope is to not loose the list level on paragraph styles. Doc model, UNO API and DOCX import/export is enough to avoid format loss, the full feature can be added separately (UI, etc). I'll look at the "just don't loose it" part.
Comment 15 Commit Notification 2021-08-27 12:00:51 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9ea594ffcf4f807306440e4628eecca8c75be8ee

tdf#137363 DOCX filter: don't loose  <w:ilvl w:val="..."> of paragraph styles

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 16 Miklos Vajna 2021-08-27 12:05:46 UTC
I think this (the "just don't loose this" piece) is now fixed on master.
Comment 17 Commit Notification 2021-09-01 16:38:52 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#137363 DOCX filter: outlineLvl not associated with iLvl

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 18 Commit Notification 2021-09-02 07:08:55 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#137363 DOCX filter: no NUMBERING_LEVEL 9(no-level) in styles

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 19 Commit Notification 2021-09-02 17:25:29 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6d9b61c22a5b4372bf5592556d21c8417ed22bfa

Related: tdf#137363 ODT import: handle style:list-level="..." for para styles

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 20 Commit Notification 2021-09-03 06:31:34 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1a6530787579fe466a67a98ef1f1a2087715a1b2

related tdf#137363: no NUMBERING_LEVEL 9(no-level) in para

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 21 Michelle 2021-09-07 02:27:35 UTC
I've done some testing and this issue is now indeed resolved for my use cases.

Thankyou very much everyone :)
Comment 22 Timur 2021-09-07 06:52:37 UTC
I think this should go to https://wiki.documentfoundation.org/ReleaseNotes/7.3
Comment 23 Miklos Vajna 2021-09-07 07:10:52 UTC
I'll take care of that.
Comment 24 Commit Notification 2021-09-13 06:53:36 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#137363 DOC export: don't lose sprmPIlvl of para 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 25 Justin L 2021-09-13 15:58:04 UTC
An abandoned patch (fails make CppunitTest_sw_ww8export3) for DOC import is at https://gerrit.libreoffice.org/c/core/+/121908