Bug 148710

Summary: Layout of an image in docx file is different from the layout in odt file, even when the anchorings used are docx-compatible ones (i.e., "as char" and "to char" anchorings)
Product: LibreOffice Reporter: Jambunathan K <kjambunathan>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: aron.budea, rb.henschel
Priority: medium Keywords: bibisected, bisected, regression
Version: 4.4.0.3 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 133537    
Attachments: frames.odt: This file uses only "as-char" and "to char" anchorings
frames.docx: This is what you get when you save `frames.odt` to `docx` format
to-char-anchoring: difference-in-layout-between-odt-and-docx.png: Note the difference in layout between ODT and DOCX version
Outer Frame Config.png: This frame limits the paragraph width to 7.1cm or so
Config of Frame Containing Text "(1)".png: This frame is positioned to the "right" of "paragraph text area"

Description Jambunathan K 2022-04-21 14:10:42 UTC
Description:
Layout of an image in docx file is different from the layout in odt file. This is even when the anchoring used are docx-compatible.  In other words, the ODT file uses ony "as character" and "to character" anchorings which are translatable to docx (and deliberately avoids the "to paragraph" anchoring which is NOT translateable to docx format)

Steps to Reproduce:
1. `frames.odt`: This file uses anchoring which are "docx" compatible i.e., it uses only "as character" and "to character" anchoring.
2. `frames.docx`:  This is the docx version of `frames.odt`


Actual Results:
The `frames.odt` and `frames.docx` should be laid out the same way.

Expected Results:
The `frames.odt` and `frames.docx` are laid out differently.  See the attached annotation in attached screenshot for details.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.3.2.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 5.16; UI render: default; VCL: x11
Locale: en-IN (en_IN); UI: en-US
Debian package version: 1:7.3.1-1
Calc: threaded


$ dpkg -l | grep writer
ii  libreoffice-writer                                 1:7.3.1-1                          amd64        office productivity suite -- word processor
Comment 1 Jambunathan K 2022-04-21 14:11:48 UTC
Created attachment 179709 [details]
frames.odt:  This file uses only "as-char" and "to char" anchorings
Comment 2 Jambunathan K 2022-04-21 14:12:43 UTC
Created attachment 179710 [details]
frames.docx:  This is what you get when you save `frames.odt` to `docx` format
Comment 3 Jambunathan K 2022-04-21 14:17:26 UTC
Created attachment 179711 [details]
to-char-anchoring: difference-in-layout-between-odt-and-docx.png:  Note the difference in layout between ODT and DOCX version

to-char-anchoring: difference-in-layout-between-odt-and-docx.png:  Note the difference in layout between ODT and DOCX version.  

The ODT and DOCX files are shown side-by-side using a tiling window manager `EXWM` in this case. 

See image annotations for more details.
Comment 4 Jambunathan K 2022-04-21 14:18:39 UTC
Created attachment 179712 [details]
Outer Frame Config.png:  This frame limits the paragraph width to 7.1cm or so
Comment 5 Jambunathan K 2022-04-21 14:23:55 UTC
Created attachment 179713 [details]
Config of Frame Containing Text "(1)".png:  This frame is positioned to the "right" of "paragraph text area"

Config of Frame Containing Text "(1)".png:  This frame is positioned to the "right" of "paragraph text area".

This frame gets pushed to the extreme right in the DOCX file.  Note the position of this frame in ODT and DOCX files.
Comment 6 Jambunathan K 2022-04-21 14:29:59 UTC
Link for submitter's eyes only: https://github.com/kjambunathan/org-mode-ox-odt/issues/177
Comment 7 Jambunathan K 2022-04-23 02:12:19 UTC Comment hidden (obsolete)
Comment 8 Timur 2022-05-04 14:52:02 UTC
Repro 7.4+. 
It is a result of 2 commits, in 4.3 and in 4.4. Now, I can bibisect 4.4.

In 4.4: 
commit 64c8b13f248fe7ea3808c7f8e62d0d656f170378
    commit d379d18666aa42031359ca8eb34b0021960347ae  (known commit with Meta bug) 
    pre source-hash-8e67a7796f598de2f11b694542bccb48343f0d9a
    Author:     Miklos Vajna <vmiklos@collabora.co.uk>
    oox: import WPS shape with text as shape with textbox