Bug 130120 - FILESAVE DOCX Shape anchored to table moves on saving
Summary: FILESAVE DOCX Shape anchored to table moves on saving
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Attila Bakos (NISZ)
URL:
Whiteboard: target:7.0.0
Keywords: filter:docx
Depends on:
Blocks: OOXML-Shapes
  Show dependency treegraph
 
Reported: 2020-01-22 13:11 UTC by NISZ LibreOffice Team
Modified: 2020-03-13 14:50 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Word (22.53 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-01-22 13:11 UTC, NISZ LibreOffice Team
Details
The original file saved by Writer (17.49 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-01-22 13:12 UTC, NISZ LibreOffice Team
Details
Screenshot of the original and exported document side by side in Word (53.48 KB, image/png)
2020-01-22 13:20 UTC, NISZ LibreOffice Team
Details
ExportedFileFromWriter7AfterFix (14.46 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-02-24 08:00 UTC, Attila Bakos (NISZ)
Details
Result in LO 7.0.0.0.alpha0+ (20.77 KB, image/jpeg)
2020-03-13 08:59 UTC, Dieter
Details
TheSampleFileExportedWithWriter7 (14.46 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-03-13 11:23 UTC, Attila Bakos (NISZ)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2020-01-22 13:11:47 UTC
Created attachment 157322 [details]
Example file from Word

Attached simple docx document contains a table and a shape in the bottom right anchored in the table.
On saving the file and opening it in Word the shape moves to a centered position, horizontally at about the right side of the table.
Writer reopens this file incorrectly too, with the shape positioned almost at the right paper side.

Steps to reproduce:
    1. Open attached document in Writer and save it as docx

Actual results:
The shape appears horizontally centered. The Layout dialog in Word indicates that that “Layout in table cell” checkbox is now checked, while in the original file it wasn’t. Unchecking it fixes the visual position in Word.

Expected results:
The shape should retain its position.

LibreOffice details:
Version: 6.5.0.0.alpha0+ (x64)
Build ID: c7f3ac890526306804ec2bdf1256ba15a4247f13
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win; 
Locale: en-US (hu_HU); UI-Language: en-US
Calc: CL

Export of the shape started to work in 4.2, and it is positioned the same in Word ever since.
Comment 1 NISZ LibreOffice Team 2020-01-22 13:12:35 UTC
Created attachment 157323 [details]
The original file saved by Writer
Comment 2 NISZ LibreOffice Team 2020-01-22 13:20:41 UTC
Created attachment 157324 [details]
Screenshot of the original and exported document side by side in Word
Comment 3 Dieter 2020-01-22 21:40:16 UTC
(In reply to NISZ LibreOffice Team from comment #0)
> The shape appears horizontally centered.

I can't see that in your attachments (or I don't understand it)
Comment 4 Gabor Kelemen (allotropia) 2020-01-23 17:48:23 UTC
(In reply to Dieter Praas from comment #3)
> (In reply to NISZ LibreOffice Team from comment #0)
> > The shape appears horizontally centered.
> 
> I can't see that in your attachments (or I don't understand it)

It's the page numbering (or similar) "7" at the bottom of the page, highlighted with yellow on the screenshot.
Comment 5 Dieter 2020-01-23 18:30:34 UTC
I confirm it with

Version: 6.5.0.0.alpha0+ (x64)
Build ID: 350d25da375f221edfa37309324ce3c68cf297ef
CPU threads: 4; OS: Windows 10.0 Build 18362; UI render: default; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-GB
Calc: threaded
Comment 6 Attila Bakos (NISZ) 2020-02-07 11:22:47 UTC
If I uncheck in Word the LayoutInCell option at the position anchor settings, the shape moves back to its original right place. So on export this option had to be handled.
In Writer on import, the position of the shape is calculated from left instead of right what set in Word, and the calculation of this does not respect the layout in cell option, this might cause this difference (because this option only checks from left calculating instead of both.)
Comment 7 Commit Notification 2020-02-21 15:10:17 UTC
Bakos Attila committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ad8857dab30e099a0cf6ec18d184a6c836b33317

tdf#130120 DOCX: export o:allowincell

It will be available in 7.0.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 8 Attila Bakos (NISZ) 2020-02-24 08:00:07 UTC
Created attachment 158131 [details]
ExportedFileFromWriter7AfterFix

The attached file exported from the master with the patch, and seems correctly. Resolved fixed.
Comment 9 Dieter 2020-03-13 08:58:01 UTC
(In reply to NISZ LibreOffice Team from comment #0)
> Writer reopens this file incorrectly too, with the shape positioned almost
> at the right paper side.

As far as I can see, this is still the case in

Version: 7.0.0.0.alpha0+ (x64)
Build ID: c63148ba139bd6b9ae7a0f9e24e51f29e5370963
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-GB
Calc: threaded
Comment 10 Dieter 2020-03-13 08:59:30 UTC
Created attachment 158666 [details]
Result in LO 7.0.0.0.alpha0+

Is this the correct result?
Comment 11 Attila Bakos (NISZ) 2020-03-13 11:23:26 UTC
Created attachment 158668 [details]
TheSampleFileExportedWithWriter7

Hi,

It work for me on:

Version: 7.0.0.0.alpha0+ (x64)
Build ID: 0d81a613ef5af22253e51d9917c5d5c94d764456
CPU threads: 8; OS: Windows 10.0 Build 17134; UI render: Skia/Raster; VCL: win; 
Locale: hu-HU (hu_HU); UI-Language: en-GB
Calc: CL

see this attachment. I will take a look later.
Comment 12 Dieter 2020-03-13 14:50:41 UTC
Perhaps I haven't used the correct document. It works with your documents from comment 8 and comment 11. Sorry for confusion.

=> VERIFIED FIXED