Bug 117692 - Frame at top of page moves into header with wrong padding when reloading exported DOCX
Summary: Frame at top of page moves into header with wrong padding when reloading expo...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:docx
: 140966 143034 (view as bug list)
Depends on:
Blocks: DOCX-Textbox WPS-Support WPSShapeTextImport-Change
  Show dependency treegraph
 
Reported: 2018-05-18 12:37 UTC by Aron Budea
Modified: 2022-05-03 11:35 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample ODT (8.98 KB, application/vnd.oasis.opendocument.text)
2018-05-18 12:37 UTC, Aron Budea
Details
Sample DOCX (saved from ODT with LO 6.1 alpha1) (4.77 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-05-18 12:38 UTC, Aron Budea
Details
Screenshot of DOCX in Writer (71.24 KB, image/png)
2018-05-18 12:39 UTC, Aron Budea
Details
Screenshot of the original and exported document side by side in Writer (90.93 KB, image/png)
2020-05-18 08:21 UTC, NISZ LibreOffice Team
Details
The example file and its docx version in Writer (93.99 KB, image/png)
2021-06-15 07:12 UTC, NISZ LibreOffice Team
Details
More comprehensive test doc with all 4 vertical alignment options to Paragraph text area (20.45 KB, application/vnd.oasis.opendocument.text)
2021-06-15 07:18 UTC, NISZ LibreOffice Team
Details
The more comprehensive test doc saved as DOCX (6.02 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-06-15 07:19 UTC, NISZ LibreOffice Team
Details
The more comprehensive doc and its DOCX version in Writer (181.40 KB, image/png)
2021-06-15 07:23 UTC, NISZ LibreOffice Team
Details
The more comprehensive doc and its DOCX version in Word (180.45 KB, image/png)
2021-06-15 07:34 UTC, NISZ LibreOffice Team
Details
The more comprehensive doc and its DOCX version in older Writer (148.97 KB, image/png)
2021-06-15 08:08 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2018-05-18 12:37:19 UTC
Created attachment 142188 [details]
Sample ODT

- Add a frame to an empty document via Insert -> Frame -> Frame...
- Save as DOCX and reload.

=> Frame is moved into header, and its padding becomes shifted (it also becomes a drawing object instead of a text frame, I guess that is related to export/import conversion).

My guess is that it is an issue during import, as the exported DOCX shows fine in Word, but if the DOCX is opened (badly)/saved in Writer, the result still shows fine in Word, so it's hard to say.

Attaching an ODT, an exported DOCX and a screenshot.

Observed using LO 6.1 alpha1 & 4.4.0.3 / Windows 7.
In 4.3.0.4 the frame ends up in the header, but the padding is fine.
In 4.2.0.4 the frame stays inside the page area.
Comment 1 Aron Budea 2018-05-18 12:38:00 UTC
Created attachment 142189 [details]
Sample DOCX (saved from ODT with LO 6.1 alpha1)
Comment 2 Aron Budea 2018-05-18 12:39:40 UTC
Created attachment 142190 [details]
Screenshot of DOCX in Writer
Comment 3 Aron Budea 2018-05-18 12:46:52 UTC
Bibisected the first issue to the following commit using repo bibisect-43max, and the DOCX saved in a recent LO version (saving the file in DOCX was crashing in nearby commits).

https://cgit.freedesktop.org/libreoffice/core/commit/?id=57450afb768c085df0ba2344aa94b5f843060178
author		Miklos Vajna <vmiklos@collabora.co.uk>	2013-12-03 11:59:42 +0100
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2013-12-03 15:39:04 +0100

"DOCX import: declare wps as a supported feature"


Bibisected the second issue to the following commit using repo bibisect-44max, and the DOCX saved in a recent LO version.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=d379d18666aa42031359ca8eb34b0021960347ae
author		Miklos Vajna <vmiklos@collabora.co.uk>	2014-06-18 11:57:31 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2014-06-18 12:09:15 +0200

"oox: import WPS shape with text as shape with textbox"

Technically these are probably rather implementation errors rather than regressions. Adding Cc: to Miklos Vajna, please take a look sometimes.
Comment 4 Jackey Jhon 2018-06-08 16:50:52 UTC Comment hidden (spam)
Comment 5 Jackey Jhon 2018-06-08 16:58:43 UTC Comment hidden (spam)
Comment 6 Xisco Faulí 2018-07-09 15:47:20 UTC
Moving to new as this has been bisected!
Comment 7 Xisco Faulí 2018-07-09 15:50:20 UTC Comment hidden (obsolete)
Comment 8 Xisco Faulí 2018-07-09 15:53:44 UTC
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=d379d18666aa42031359ca8eb34b0021960347ae
> author		Miklos Vajna <vmiklos@collabora.co.uk>	2014-06-18 11:57:31 +0200
> committer	Miklos Vajna <vmiklos@collabora.co.uk>	2014-06-18 12:09:15 +0200

bug 109077, bug 109137 and bug 107428 are also affected by this commit
Comment 9 Jack Smith 2018-07-31 19:51:06 UTC Comment hidden (spam)
Comment 10 roger chase 2018-08-02 06:39:24 UTC Comment hidden (spam)
Comment 11 roger chase 2018-09-05 06:13:43 UTC Comment hidden (spam)
Comment 12 jameswill 2019-04-27 15:32:09 UTC Comment hidden (spam)
Comment 13 mcafeenumber 2019-07-11 05:12:51 UTC Comment hidden (spam)
Comment 14 sbcglobalsupport 2019-07-19 10:34:10 UTC Comment hidden (spam)
Comment 15 NISZ LibreOffice Team 2020-05-18 08:21:16 UTC
Created attachment 160963 [details]
Screenshot of the original and exported document side by side in Writer

Still present in:

Version: 7.0.0.0.alpha1+ (x64)
Build ID: 1ed7607454d1492f65c78443cb661d5873face6b
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win; 
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL
Comment 16 Xisco Faulí 2021-01-13 19:35:15 UTC
Still reproducible in

Version: 7.2.0.0.alpha0+
Build ID: e027a91010a4517cfa907f3d80c9188f026b3823
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

the padding inside the frame is no longer wrong
Comment 17 Schmitz Nellie 2021-01-29 08:39:26 UTC Comment hidden (spam)
Comment 18 NISZ LibreOffice Team 2021-03-12 12:50:49 UTC
*** Bug 140966 has been marked as a duplicate of this bug. ***
Comment 19 NISZ LibreOffice Team 2021-06-15 07:12:06 UTC
Created attachment 172888 [details]
The example file and its docx version in Writer

This seems to have changed recently, and looks kinda good in:

Version: 7.2.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: 93a3e2f86c27b06062708fe788963a0e49f3a90b
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: default; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: CL

I suspect this might have been it:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=2f21e4f357ec60450df84ddd858c3cf0a4711b02

tdf#139915 DOCX import: fix anchored obj position with to-char and TEXT_LINE

Vertical alignment of Top to Paragraph area now becomes Top to Line of text.

However the two things are not exactly the same, but Word only has Line of text and no Paragraph area. 
This difference is more visible in several lines long paragraphs.
Comment 20 NISZ LibreOffice Team 2021-06-15 07:18:28 UTC
Created attachment 172890 [details]
More comprehensive test doc with all 4 vertical alignment options to Paragraph text area
Comment 21 NISZ LibreOffice Team 2021-06-15 07:19:03 UTC
Created attachment 172891 [details]
The more comprehensive test doc saved as DOCX
Comment 22 NISZ LibreOffice Team 2021-06-15 07:23:02 UTC
Created attachment 172892 [details]
The more comprehensive doc and its DOCX version in Writer

The 4 Paragraph text area alignment options change this way in Writer:
Top: becomes Top to Line of text
Bottom: also becomes Top to Line of text
Center: also becomes Top to Line of text
From Top by 1.5 cm: becomes From Bottom by 0.5 cm to Line of text.
Comment 23 NISZ LibreOffice Team 2021-06-15 07:34:15 UTC
Created attachment 172893 [details]
The more comprehensive doc and its DOCX version in Word

The 4 Paragraph text area alignment options change this way in Writer:
Top: becomes Top relative to Line of text
Bottom: becomes Bottom relative to Line of text
Center: becomes Center aligned relative to Line of text
From Top by 1.5 cm: becomes Absolute position by 1.5 cm below Line of text.

Looks more like an import problem. 
Also anchor is originally to Paragraph but after export-import it becomes To character.

Related bug 142855 is the:
Bottom: also becomes Top to Line of text in Writer (previous comment)
Bottom: becomes Bottom relative to Line of text in Word (this comment)
case.
Comment 24 NISZ LibreOffice Team 2021-06-15 08:05:53 UTC
In the slightly older bibisect-7.2 version the 4 alignments in docx were read as:

Top: became Bottom to Margin
Bottom: became Top to Margin
(manually swapping these fixes the display)
Center: became Center to Margin (good!)
From Top by 1.5 cm: became From top by 1.50 cm to Margin (good!)

Version: 7.2.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: 4d800dd7b58291386850d69570d027192419c5a0
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded
Comment 25 NISZ LibreOffice Team 2021-06-15 08:08:29 UTC
Created attachment 172894 [details]
The more comprehensive doc and its DOCX version in older Writer
Comment 26 Telesto 2021-06-25 09:19:30 UTC
*** Bug 143034 has been marked as a duplicate of this bug. ***
Comment 27 OliviaSamantha 2021-12-03 08:17:15 UTC Comment hidden (spam)
Comment 28 Xisco Faulí 2022-05-03 11:35:01 UTC
Dear  Tibor Nagy (NISZ),
This bug has been in ASSIGNED status for more than 3 months without any
activity. Resetting it to NEW.
Please assign it back to yourself if you're still working on this.