Bug 132976 - FILEOPEN DOCX Text box horizontal size grows with relative width to left margin
Summary: FILEOPEN DOCX Text box horizontal size grows with relative width to left margin
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: All All
: medium normal
Assignee: Szabolcs Toth
URL:
Whiteboard: target:7.1.0 target:7.0.0.1
Keywords: bibisected, bisected, regression
Depends on:
Blocks: OOXML-Shapes
  Show dependency treegraph
 
Reported: 2020-05-12 12:18 UTC by NISZ LibreOffice Team
Modified: 2020-06-25 13:40 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Example file from Word (26.21 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-05-12 12:18 UTC, NISZ LibreOffice Team
Details
Shape size settings in Word (41.11 KB, image/png)
2020-05-12 12:19 UTC, NISZ LibreOffice Team
Details
Screenshot of the original document side by side in Word and Writer (72.12 KB, image/png)
2020-05-12 12:19 UTC, NISZ LibreOffice Team
Details
Page number frame in the right page margin (22.38 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-06-10 14:08 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2020-05-12 12:18:56 UTC
Created attachment 160718 [details]
Example file from Word

Attached document contains a text box with page number inserted from Word using the Header / Footer tools -> Page number -> On page margin -> Page X -> Emphasized band on the left. 
When opening this file in Writer, the text box horizontal size grows significantly.
Same preset has a right side variant, which works: relative width from right margin opens with correct size.


Steps to reproduce:
    1. Open attached document 
    2. Or insert a custom Word page number field with:
    3. Header / Footer tools -> Page number -> On page margin -> Page X -> Emphasized band, save document and open in Writer

Actual results:
Text box is almost as wide as the page instead of about 2cm.

Expected results:
Narrow box at the left margin.

LibreOffice details:
Version: 7.0.0.0.alpha1+ (x64)
Build ID: 0e3196c49b84651df20b770d5cd7f0bbb19dfc40
CPU szálak: 4; OS: Windows 6.3 Build 9600; Felületmegjelenítés: Skia/Raster; VCL: win; 
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL

Also happens in:
Verzió: 6.0.0.3
Build az.: 64a0f66915f38c6217de274f0aa8e15618924765
CPU szálak: 4; OS: Windows 6.3; Felületmegjelenítés: GL; 
Területi beállítások: hu-HU (hu_HU); Calc: CL

Version: 5.0.0.5
Build ID: 1b1a90865e348b492231e1c451437d7a15bb262b
Locale: hu-HU (hu_HU)

Version: 4.3.0.4
Build ID: 62ad5818884a2fc2e5780dd45466868d41009ec0

But not in: 
Verzió: 4.2.0.4
Build az.: 05dceb5d363845f2cf968344d7adab8dcfb2ba71

Bibisected using bibisect-win32-4.3 to: 
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=166af05c63598426c375544b5e1e01818aa13747
author	Miklos Vajna <vmiklos@collabora.co.uk>	2014-01-27 17:51:50 +0100
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2014-01-27 18:00:10 +0100

DOCX import: handle wp14:pctWidth for Writer TextFrames

Adding CC to: Miklos Vajna
Comment 1 NISZ LibreOffice Team 2020-05-12 12:19:21 UTC
Created attachment 160719 [details]
Shape size settings in Word
Comment 2 NISZ LibreOffice Team 2020-05-12 12:19:42 UTC
Created attachment 160720 [details]
Screenshot of the original document side by side in Word and Writer
Comment 3 Xisco Faulí 2020-05-13 12:25:21 UTC
Reproduced in

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

Adding Cc to: Miklos Vajna
Comment 4 Regina Henschel 2020-06-10 14:08:05 UTC
Created attachment 161839 [details]
Page number frame in the right page margin

(In reply to NISZ LibreOffice Team from comment #0)
> Created attachment 160718 [details]
> Same preset has a right side variant, which works: relative width from right
> margin opens with correct size.

I see the same error with the page number in the right margin.

It is an import error. Neither ODF (current 1.3) nor LibreOffice have means to express the width relative to the page margin, but the width is always a fixed length. So the relative value of Word should be transformed in a fixed length during import. You might keep the fact, that it is relative in Word in the operability bag, so that you can recreate the percent value on export to docx.

The position as relative to "right margin" is interpreted correctly and can be written to ODF without problems.

In case you intend to extend LibreOffice so, that width of objects (which objects?) can be set relative to a reference (which references?) please write a feature request for ODF for review here before finishing the implementation.
Comment 5 László Németh 2020-06-12 12:40:24 UTC
@Szabolcs, Balázs: it seems, LO has already supported this in most of the use cases, see lo-ext "layout-attribute" in https://issues.oasis-open.org/browse/OFFICE-3854, and the related code parts.
Comment 6 Commit Notification 2020-06-23 14:20:52 UTC
Szabolcs Toth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7380905abc0833d9e4c4fe731d76174db8a8724c

tdf#132976 DOCX import: fix shape width relative to left margin

It will be available in 7.1.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 7 Commit Notification 2020-06-25 10:18:29 UTC
Szabolcs Toth committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/5451833f3af5582a8cab7e4b3da402f083f56908

tdf#132976 DOCX import: fix shape width relative to left margin

It will be available in 7.0.0.1.

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.