Bug 137270 - FILEOPEN DOC/DOCX: Displaying one page instead of multiple because all images overlap
Summary: FILEOPEN DOC/DOCX: Displaying one page instead of multiple because all images...
Status: RESOLVED DUPLICATE of bug 138782
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Attila Bakos (NISZ)
Keywords: bibisected, bisected, filter:docx
Depends on:
Blocks: DOCX-Images
  Show dependency treegraph
Reported: 2020-10-05 14:39 UTC by Rhys Young
Modified: 2021-05-05 13:14 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

Test file, displaying a singular page (848.21 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-10-05 14:40 UTC, Rhys Young
Bibisect log (3.06 KB, text/plain)
2020-10-06 14:36 UTC, Telesto
Test file saved in MSO as DOC (1009.00 KB, application/msword)
2020-10-20 07:18 UTC, Timur
Screenshot of the original document side by side in Word and Writer after changing horizontal position (198.88 KB, image/png)
2020-12-10 12:02 UTC, NISZ LibreOffice Team

Note You need to log in before you can comment on or make changes to this bug.
Description Rhys Young 2020-10-05 14:39:30 UTC
When opening the file in Libre Office it only displays a singular page instead of multiple pages like the word docx does.

Steps to Reproduce:
1. Open the attached file in word, note the number of pages.
2. Open the attached file in latest LO, note that there is only one page.

Actual Results:
LO displays a singular page instead of multiple.

Expected Results:
LO should display multiple pages.

Reproducible: Always

User Profile Reset: No

Additional Info:
Comment 1 Rhys Young 2020-10-05 14:40:08 UTC
Created attachment 166094 [details]
Test file,  displaying a singular page
Comment 2 Telesto 2020-10-05 15:43:32 UTC
Repro with
Version: (x64)
Build ID: 7f16cabf00daa30e9284d2fb2494bd341352c25e
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL

and with

and with
Build ID: c30963b8b4bbbe42a24b97aafa161eff9d7ccdd4
CPU threads: 4; OS: Windows 6.3; UI render: default; 
Locale: nl-NL (nl_NL); Calc: CL

fine with
Comment 3 Telesto 2020-10-05 22:19:20 UTC
Also found in
Build ID: e5ebc3d73156f217161e6b857026eae49fa91ea9
CPU Threads: 2; OS Version: Linux 5.3; UI Render: default; VCL: x11; 
Locale: en-US (en_US.UTF-8); Calc: group

but not in oldest of 5.2 bibisect
Comment 4 Telesto 2020-10-06 14:36:45 UTC
Created attachment 166126 [details]
Bibisect log

Bisected to
author	Tamás Zolnai <tamas.zolnai@collabora.com>	2016-12-21 01:23:11 +0000
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2017-01-05 09:11:58 +0000
commit a5f5312de639048dac65da292f2b2dcc330cee15 (patch)
tree 3cc57b07c1f08bb6eefe224d917570e39a963dd2
parent f84516a348ea8e05bbf89816505a6041e711ebfd (diff)
tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position
layoutInCell attribute should be ignored when we are not
in a table.

Reviewed-on: https://gerrit.libreoffice.org/32253
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 36750bc977b3210b23b7822abd395b30a78af6f5)


Comment 5 Telesto 2020-10-06 14:37:49 UTC Comment hidden (obsolete)
Comment 6 Tamás Zolnai 2020-10-12 14:35:54 UTC
I checked this issue. My change was correct, since layoutInCell attribute should be applied only when the image is inside a table. In the test doucment, there is no tables, so it's correct that layoutInCell attribute is ignored. This change just uncovered an other issue.

The issue is that not only the layoutInCell attributes makes the image follow the text flow. In MSO there is another option that has similar behavior. This is called "Move object with text" on the UI. That setting should be applied on this document by LO. However as I see this option is not explicitly exported to DOCX file format, but it depends on the relative vertical position setting.

I added a patch that fix that on import side: https://gerrit.libreoffice.org/c/core/+/104127. However I abandoned it because it needs more work to avoid other issues. It would work with MSO produced DOCX files, but it don't work with LO exported DOCX files. So I leave this issue to those who can invest a bigger amount of time into this issue.
Comment 7 Timur 2020-10-20 07:18:29 UTC
Created attachment 166527 [details]
Test file saved in MSO as DOC

Also with DOC. Let's keep it here so far.
Comment 8 NISZ LibreOffice Team 2020-12-10 12:02:01 UTC
Created attachment 168033 [details]
Screenshot of the original document side by side in Word and Writer after changing horizontal position

These images are horizontally positioned "to column" which is imported as "to paragraph area". 
Manually changing this setting to "Left paragraph border" in Writer restores the original layout of the file.

See bug #138782 about this.
Comment 9 Attila Bakos (NISZ) 2021-05-05 06:29:28 UTC

*** This bug has been marked as a duplicate of bug 138782 ***
Comment 10 Timur 2021-05-05 13:06:37 UTC
DOCX is fixed, I'll open a new bug for DOC.