Bug 105261 - LAYOUT DOCX: paragraph margin start not modified when wrapping around frame (comment 17)
Summary: LAYOUT DOCX: paragraph margin start not modified when wrapping around frame (...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
4.2 all versions
Hardware: All All
: low normal
Assignee: Not Assigned
URL:
Whiteboard: compatibilityMode14
Keywords: bibisected, bisected, filter:docx
: 105373 144804 (view as bug list)
Depends on:
Blocks: DOCX-Anchor-and-Text-Wrap DOCX-Canvas-Shape 60558
  Show dependency treegraph
 
Reported: 2017-01-11 17:25 UTC by Marina Latini (SUSE)
Modified: 2023-10-11 15:36 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
docx affected file (25.42 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-01-11 17:26 UTC, Marina Latini (SUSE)
Details
good rendering (46.11 KB, application/pdf)
2017-01-11 17:28 UTC, Marina Latini (SUSE)
Details
bad rendering with LibO 6.0.0.2.0+ (20.15 KB, application/pdf)
2018-01-29 08:50 UTC, Marina Latini (SUSE)
Details
docx without wrap-around table (26.88 KB, application/vnd.ms-word.document)
2018-01-29 09:45 UTC, Timur
Details
The reference rendering and original file in Writer master (199.18 KB, image/png)
2020-09-13 09:58 UTC, Gabor Kelemen (allotropia)
Details
DOCX compared in MSO and oldeer and newer LO (134.70 KB, image/png)
2020-09-14 07:18 UTC, Timur
Details
How it looks in Word 2016 and master (131.36 KB, image/png)
2023-04-28 10:00 UTC, Gabor Kelemen (allotropia)
Details
badRendering_min.docx: minimized example using image instead of floating table (65.48 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-06-01 20:54 UTC, Justin L
Details
badRendering_min_compat15.docx: resaved by Word 2016 in its native format (66.02 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-09-11 18:04 UTC, Justin L
Details
badRendering_min_compat15.pdf: How it looks in MS Word 2016 (same as LO) (41.09 KB, application/pdf)
2023-09-11 18:12 UTC, Justin L
Details
badRendering_min2a.docx: modified by Word 2010 - no oval visible (26.13 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-09-12 14:29 UTC, Justin L
Details
badRendering_min2a.pdf: how it looks in MS Word (168.44 KB, application/pdf)
2023-09-12 14:30 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marina Latini (SUSE) 2017-01-11 17:25:37 UTC
Description:
bad rendering of the attached docx file.

Steps to Reproduce:
1. open the attached docx file

Actual Results:  
The formatting is completely lost

Expected Results:
The file is rendered like the attached PDF.


Reproducible: Always

User Profile Reset: Yes

Additional Info:
Tested with:

Version: 5.1.6.2
Build ID: 07ac168c60a517dba0f0d7bc7540f5afa45f0909
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; 
Locale: it-IT (it_IT.UTF-8); Calc: group

Versione: 5.2.3.3
Build ID: 20m0(Build:3)
Thread CPU: 4; Versione SO: Linux 4.8; Resa interfaccia: predefinito; 
Versione locale: it-IT (it_IT.UTF-8); Calc: single

Version: 5.2.4.2
Build ID: 3d5603e1122f0f102b62521720ab13a38a4e0eb0
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk2; 
Locale: it-IT (it_IT.UTF-8); Calc: group



User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2946.0 Safari/537.36
Comment 1 Marina Latini (SUSE) 2017-01-11 17:26:58 UTC
Created attachment 130321 [details]
docx affected file
Comment 2 Marina Latini (SUSE) 2017-01-11 17:28:03 UTC
Created attachment 130322 [details]
good rendering

pdf with the correct rendering
Comment 3 Marina Latini (SUSE) 2017-01-11 17:32:21 UTC Comment hidden (no-value)
Comment 4 Xisco Faulí 2017-01-11 20:31:02 UTC
Confirmed in

- Version: 5.4.0.0.alpha0+
Build ID: 9a30cb2161506e003f14592d83075ab9d30516c1
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk2; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

- Version: 4.5.0.0.alpha0+
Build ID: 2851ce5afd0f37764cbbc2c2a9a63c7adc844311
Locale: ca_ES

however the layout seems correct in

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4

in

Version: 4.2.0.0.alpha0+
Build ID: 7f4a622f9fbf27774efa908348e682df7280713b

the layout was worse than in 3.3 but better than it's nowadays.

Layout became completely messed up by:

author	Adam Co <rattles2013@gmail.com>	2013-06-26 08:08:56 (GMT)
committer	Miklos Vajna <vmiklos@suse.cz>	2013-06-28 09:43:48 (GMT)
commit 74c5ed19f430327988194cdcd6bdff09591a93fa (patch)
tree 3c13fe12ac592a1d0acb6caf273f12a1d0e15433
parent 7f4a622f9fbf27774efa908348e682df7280713b (diff)
DOCX import fix for table with auto size

Adding Cc: to Adam Co
Comment 5 QA Administrators 2018-01-12 03:30:43 UTC Comment hidden (obsolete)
Comment 6 Marina Latini (SUSE) 2018-01-29 08:48:19 UTC Comment hidden (obsolete)
Comment 7 Marina Latini (SUSE) 2018-01-29 08:50:06 UTC Comment hidden (obsolete)
Comment 8 Timur 2018-01-29 09:45:16 UTC
Created attachment 139425 [details]
docx without wrap-around table

Bad rendering is bad bug description :)
Looks like already existing wrap-around table issue, worsen with shapes around table. 
If wrap is set to None in MSO and than layout fixed, opens fine in LO.
So, looks like a duplicate to me, but since it's worsen by shapes, may remain open separately for a check should wrap-around ever be resolved.
Comment 9 Timur 2018-01-29 10:09:03 UTC
Attachment 130321 [details] also suffers from Bug 108493. 
I had to correct that in attachment 139425 [details] to have a proper look.
Comment 10 Marina Latini (SUSE) 2018-12-21 08:32:40 UTC
repro on:
Versione: 6.2.0.1 (x64)
Build ID: 0412ee99e862f384c1106d0841a950c4cfaa9df1
Thread CPU: 4; SO: Windows 10.0; Resa interfaccia: GL; VCL: win; 
Versione locale: de-DE (en_US); UI-Language: it-IT
Calc: threaded
Comment 11 Gabor Kelemen (allotropia) 2020-09-13 09:58:06 UTC
Created attachment 165448 [details]
The reference rendering and original file in Writer master

Looks a lot better now in:

Version: 7.1.0.0.alpha0+
Build ID: 3a22f5a589e822e7ca8bbb00e38a3aff93ed7ba5
CPU threads: 16; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: threaded

from bibisect-7.1 repo. 
Same in 7.0 stable too.
Overlap of frames and tables started to get better with:

https://git.libreoffice.org/core/+/fd7749fddc5a767461dfced55369af48e5a6d561

author	Miklos Vajna <vmiklos@collabora.com>	Fri Feb 14 16:29:44 2020 +0100
committer	Miklos Vajna <vmiklos@collabora.com>	Fri Feb 14 18:37:34 2020 +0100

sw: fix handling of table vs fly overlaps in the AddVerticalFlyOffsets case
Comment 12 Timur 2020-09-14 07:18:47 UTC Comment hidden (obsolete)
Comment 13 NISZ LibreOffice Team 2020-09-14 13:55:53 UTC
(In reply to Timur from comment #12)
> Created attachment 165473 [details]
> DOCX compared in MSO and oldeer and newer LO
> 
> As Gabor was kind to test, this is much better in 7.1+. So I set low
> priority. 
> We need to define the current problem and rename the title.

There are two minor issues left:
- The top table is floating so the two empty paragraphs before the second table (with DATA and TICKET NUMBER) are on its right in Writer and not below it like in Word.
- The rounded rectangle is actually a canvas object (in VML) containing a floating table (with Ragione Sociale Cliente) and a rounded rectangle shape. This is imported as a grouped shape containing a table frame and a shape.
Wrapping of this mess is again not the same as in Word so there is a bit less space - in form of a semi-overlapped empty paragraph - between this and the next table (TIPOLOGIA CONTRATTO)

I guess this can mostly be one more bug to the "wrapping of floating table" pile of bug #61594
Comment 14 QA Administrators 2023-01-12 03:20:36 UTC Comment hidden (obsolete)
Comment 15 Gabor Kelemen (allotropia) 2023-04-28 09:56:24 UTC
(In reply to NISZ LibreOffice Team from comment #13)
> There are two minor issues left:
> - The top table is floating so the two empty paragraphs before the second
> table (with DATA and TICKET NUMBER) are on its right in Writer and not below
> it like in Word.

This has changed in 7.4, with the rounded rectangle (another canvas shape)  moved above the 
"AUTORIZZAZIONE INTERVENTO ASSISTENZA (AI)" table in the top right. 
This is not good actually, since this is not visible in Word.

https://git.libreoffice.org/core/+/cee9b476d51f770fba03cb20b58370762d387e63

author	Miklos Vajna <vmiklos@collabora.com>	Thu Mar 10 08:18:55 2022 +0100
committer	Miklos Vajna <vmiklos@collabora.com>	Thu Mar 10 09:20:28 2022 +0100

sw clearing breaks: fix layout when the line is empty

> - The rounded rectangle is actually a canvas object (in VML) containing a
> floating table (with Ragione Sociale Cliente) and a rounded rectangle shape.
> This is imported as a grouped shape containing a table frame and a shape.
> Wrapping of this mess is again not the same as in Word so there is a bit
> less space - in form of a semi-overlapped empty paragraph - between this and
> the next table (TIPOLOGIA CONTRATTO)
> 

This also changed in the above commit 7.4, the empty paragraph is there now. This part improved.

> I guess this can mostly be one more bug to the "wrapping of floating table"
> pile of bug #61594

Looks like this file was not so much affected by recent improvements there.
Comment 16 Gabor Kelemen (allotropia) 2023-04-28 10:00:22 UTC
Created attachment 186977 [details]
How it looks in Word 2016 and master

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9a555d79b3b00793edf1d51a8a7c76b723cc436d
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded
Comment 17 Justin L 2023-06-01 20:53:39 UTC
repro 7.6+ after many floating table fixes

Comment 16 shows that this looks nearly perfect now.

The biggest glaring problem is that the nice looking rounded shape around the top-right cell is not supposed to be visible.

The reason it is invisible is because it is wrapping around the floating table. Since the table extended so far, the "paragraph area" starts at around 18cm, and the drawing canvas should be positioned offscreen by another 7.32 cm at approximately 25.5cm

Removing "floating table" meta bug, and replacing it with "wrapping" meta.
Comment 18 Justin L 2023-06-01 20:54:59 UTC
Created attachment 187652 [details]
badRendering_min.docx: minimized example using image instead of floating table
Comment 19 Justin L 2023-08-18 18:37:53 UTC
*** Bug 105373 has been marked as a duplicate of this bug. ***
Comment 20 Justin L 2023-09-11 18:01:09 UTC
*** Bug 144804 has been marked as a duplicate of this bug. ***
Comment 21 Justin L 2023-09-11 18:04:08 UTC
Created attachment 189501 [details]
badRendering_min_compat15.docx: resaved by Word 2016 in its native format

When MS Word drops the compatibility level, then it behaves like LO currently does.
Comment 22 Justin L 2023-09-11 18:12:56 UTC
Created attachment 189502 [details]
badRendering_min_compat15.pdf: How it looks in MS Word 2016 (same as LO)
Comment 23 Justin L 2023-09-12 14:09:19 UTC
(In reply to Justin L from comment #18)
> Created attachment 187652 [details]
> badRendering_min.docx: minimized example
Now I am confusing myself, because this minimized file looks correct in this compat14 version, and also in the compat15 version, ever since
7.1.4 commit 5812fb81013cc124a9b6a0b9912a34cc715fc495
Author: Attila Bakos (NISZ) on Thu Apr 22 13:26:58 2021 +0200
    tdf#138782 DOCX import: fix frame positions of old docs

However, OP's example (using a floating table) does not do the same "paragraph margin" shifting as when wrapping around a floating image. So the task seems to be extending the same compat14 logic to floating tables as to floating images.
Comment 24 Justin L 2023-09-12 14:29:51 UTC
Created attachment 189521 [details]
badRendering_min2a.docx: modified by Word 2010 - no oval visible
Comment 25 Justin L 2023-09-12 14:30:32 UTC
Created attachment 189522 [details]
badRendering_min2a.pdf: how it looks in MS Word
Comment 26 Justin L 2023-10-11 15:36:51 UTC
Debugging code (for code pointer) at https://gerrit.libreoffice.org/c/core/+/157843.

Running away from this. AFAICS, the layout code is completely wrong here, and yet is critical for handling various cases.

Note that the problem here seems to be that the paragraph these things are anchored to is empty. Adding a non-space character "fixes" the layout. In the case of badRendering_min2a.docx, deleting the last paragraph also "fixes" it.