Bug 132752 - DOCX import: invalid paragraph indentation
Summary: DOCX import: invalid paragraph indentation
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: All All
: medium normal
Assignee: Vasily Melenchuk (CIB)
URL:
Whiteboard: target:7.2.0 target:7.1.5
Keywords:
Depends on:
Blocks: DOCX-Paragraph
  Show dependency treegraph
 
Reported: 2020-05-06 06:53 UTC by Vasily Melenchuk (CIB)
Modified: 2022-01-25 09:18 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Source DOCX file (21.99 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-05-06 06:54 UTC, Vasily Melenchuk (CIB)
Details
Visual side-by-side comparision of LO and Word (100.96 KB, image/png)
2020-05-06 06:55 UTC, Vasily Melenchuk (CIB)
Details
Source DOCX compared LO MSO paragraphs (158.84 KB, image/png)
2020-05-11 07:36 UTC, Timur
Details
Better bugdoc (33.89 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-02-17 10:50 UTC, Thorsten Behrens (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasily Melenchuk (CIB) 2020-05-06 06:53:23 UTC
Description:
Indentation for first line of paragraph for attached document is incorrect.

Expected same width for with follow up lines. Instead LO is using lesser value. See attached screenshot for visual difference.

Quick check with random older versions shows that this behavior is not a regression, bug is reproducible with master and down to 3.3.0.

Steps to Reproduce:
Open attached document (indent.docx) in Writer

Actual Results:
First line of paragraph not aligned as follow up lines.

Expected Results:
All paragraph lines are with same indent to the left.


Reproducible: Always


User Profile Reset: No



Additional Info:
-
Comment 1 Vasily Melenchuk (CIB) 2020-05-06 06:54:29 UTC
Created attachment 160411 [details]
Source DOCX file
Comment 2 Vasily Melenchuk (CIB) 2020-05-06 06:55:04 UTC
Created attachment 160412 [details]
Visual side-by-side comparision of LO and Word
Comment 3 Timur 2020-05-11 07:36:25 UTC
Created attachment 160640 [details]
Source DOCX compared LO MSO paragraphs
Comment 4 NISZ LibreOffice Team 2020-05-11 11:17:15 UTC
This seems to have an inherited hanging indent setting: 
The Hinweis style is based on the Anleitung style, which has 0.63 cm hanging indent. 
The Hinweis style overrides this with no indent setting for the first line, but Writer seems to not notice this and use the 0.63 cm hanging indent setting from the parent Anleitung style.
Comment 5 László Németh 2020-07-23 09:40:50 UTC
It seems, this is a broken document with incomplete numbering data, see

<w:numId w:val="0"/>

in style "Hinweis" without definition of the referred numbering. Saving it in Word removes this, also add w:firstLine=0, according to the ad hoc opening of the broken document.

@Vasily: if it's really possible to create such incomplete document in Word, please, reopen this issue.
Comment 6 Thorsten Behrens (allotropia) 2021-02-17 10:50:16 UTC
Created attachment 169819 [details]
Better bugdoc

Re-did the bugdoc, still shows the prob.
Comment 7 Vasily Melenchuk (CIB) 2021-04-28 08:41:43 UTC
Seems this <w:numId w:val="0"/> is actually a Word feature for following scenario:
1. We have paragraph style with some numbering.
2. We create a child paragraph style, but disable numbering in it.

In this case for child style Word does emit this reference to zero numbering. As far as I got this should be treated as a "removed numbering".

I was able to reproduce this behavior not on any existing document, but from a scratch in Word 365:
1. In new document we create new paragraph style "Style 1".
2. For this style we set some indentation (left, right and first line).
3. Also apply any random numbering to this style.
4. Create "Style 2" and set "Style 1" as a parent style.
5. For "Style 2" we remove any numberings.

Text with applied "Style 2" displayed in a different way in Word 365 and Writer: Writer does takes indentation params from "Style 1" into account, Word does not.
Comment 8 Commit Notification 2021-05-25 09:42:41 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

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

tdf#132752: docx import: improvements for first line indent in lists

It will be available in 7.2.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 9 Commit Notification 2021-05-26 09:07:29 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

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

tdf#132752: docx import: improvements for first line indent in lists

It will be available in 7.1.5.

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 10 BogdanB 2021-06-01 09:13:30 UTC
It's ok now with test documents from comments 3 and 6.

Verified in
Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: f49e5902a3737c02fabf5bec23243ccb126426c4
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded

Thanks for fixing this bug.