Bug 37153 - FILEOPEN FORMATTING Writer Text frame moved position after import of Word .doc
Summary: FILEOPEN FORMATTING Writer Text frame moved position after import of Word .doc
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.2 release
Hardware: All All
: low normal
Assignee: Justin L
URL:
Whiteboard: target:6.0.0 target:25.8.0
Keywords: filter:doc
Depends on:
Blocks: DOC
  Show dependency treegraph
 
Reported: 2011-05-12 16:43 UTC by Chris Peñalver
Modified: 2025-05-28 09:42 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
formulier1ond.doc (110.50 KB, application/msword)
2011-05-12 16:43 UTC, Chris Peñalver
Details
unlocked file - the protection password was removed. (110.50 KB, application/msword)
2017-08-31 00:19 UTC, Justin L
Details
textbox_anchorToChar.doc: simple unit test (23.50 KB, application/msword)
2017-08-31 01:06 UTC, Justin L
Details
textbox_anchorToChar2.docx: simple unit test - this time DOCX format with contentframe (16.36 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-09-02 01:37 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Peñalver 2011-05-12 16:43:23 UTC
Created attachment 46651 [details]
formulier1ond.doc

Downstream bug may be found at:
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/38569

OOo bug may be found at:
http://openoffice.org/bugzilla/show_bug.cgi?id=100379

1) lsb_release -rd
Description: Ubuntu 11.04
Release: 11.04

2) apt-cache policy libreoffice-writer
libreoffice-writer:
  Installed: 1:3.3.2-1ubuntu5
  Candidate: 1:3.3.2-1ubuntu5
  Version table:
 *** 1:3.3.2-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty-proposed/main i386
Packages
        100 /var/lib/dpkg/status
     1:3.3.2-1ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty/main i386 Packages

3) What is expected to happen in LibreOffice Writer via the Terminal:

cd ~/Desktop && wget https://bugs.launchpad.net/ubuntu/+source/openoffice.org/+bug/38569/+attachment/8966/+files/formulier1ond.doc && lowriter -nologo formulier1ond.doc

and one Page 1, Ondernemingen rectangle text frame is shifted not shifted down.

4) What happens instead is it is shifted down.
Comment 1 Björn Michaelsen 2011-12-23 12:03:57 UTC Comment hidden (obsolete, spam)
Comment 2 Chris Peñalver 2012-01-03 15:27:40 UTC
Problem reproducible in:
LOdev 3.5.0beta2 
Build ID: 8589e48-760cc4d-f39cf3d-1b2857e-60db978
Microsoft Windows Vista Business 6.0.6002 Service Pack 2 Build 6002
Comment 3 A (Andy) 2013-01-20 13:50:07 UTC
reproducible with LO 3.6.4.3. (Win7 Home, 64bit)
Comment 4 Xisco Faulí 2014-03-03 11:55:20 UTC
It's still present in:
   - Libreoffice 4.1.4.2 Build  ID: 0a0440ccc0227ad9829de5f46be37cfb6edcf72
   - Libreoffice 4.2.1.1 Build  ID: d7dbbd7842e6a58b0f521599204e827654e1fb8b
   - Libreoffice 4.3.0.0.alpha0 ID: 95700a2d7d09893fe16aadb406e93bf7164f7422
Comment 5 Joel Madero 2015-05-02 15:42:25 UTC Comment hidden (obsolete, spam)
Comment 6 Buovjaga 2015-06-20 16:03:59 UTC
Confirmed.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: 3ecef8cedb215e49237a11607197edc91639bfcd
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-06-19_23:16:58
Locale: fi-FI (fi_FI)
Comment 7 QA Administrators 2016-09-20 10:12:01 UTC Comment hidden (obsolete, spam)
Comment 8 Telesto 2017-05-10 16:42:35 UTC
Repro with
Version: 5.4.0.0.alpha1+
Build ID: 9d320ec4d818f86e58a15fd46248026502b1cc94
CPU threads: 4; OS: Windows 6.2; UI render: default; 
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2017-05-09_01:27:12
Locale: en-US (nl_NL); Calc: single
Comment 9 Justin L 2017-08-31 00:19:43 UTC
Created attachment 135890 [details]
unlocked file - the protection password was removed.

There are two "floating" tables here.  
-Federale Overheidsdienst Justitie
-Ondernemingen

Currently, the cell they are anchored in is vertically centered (table properties-Text flow-Vertical alignment=centered).  Change this to "top" in Writer, and those two floating tables will be properly placed.
Comment 10 Justin L 2017-08-31 00:24:10 UTC
(In reply to Justin L from comment #9)
> Created attachment 135890 [details]
> unlocked file - the protection password was removed.

To unlock the form, go to Tools - Options - LibreOffice Writer - Compatibility - and disable Protect Form
Comment 11 Justin L 2017-08-31 01:06:01 UTC
Created attachment 135891 [details]
textbox_anchorToChar.doc: simple unit test

In MSO, the cell vertical alignment doesn't affect the anchored object's placement, but in LO the object shifts as the vertical alignment is changed.

ODT files act the same way, so this is just a fundamental difference between LO and MSO. Not easily resolved - although images/frames FORCE the anchor to the top. However, doing the same with textboxes would cause regressions in ODT. Perhaps a compat setting candidate?
Comment 12 Justin L 2017-09-02 01:37:27 UTC
Created attachment 135958 [details]
textbox_anchorToChar2.docx: simple unit test - this time DOCX format with contentframe

proposed fix for wrap-through objects: https://gerrit.libreoffice.org/41795

Textboxes - or any content frames - are still not working.  A similar fix should enable that.
Comment 13 Justin L 2017-09-02 15:46:59 UTC
(In reply to Justin L from comment #12)
> Textboxes - or any content frames - are still not working.  A similar fix
> should enable that.
Wrong diagnosis.

Instead, the problem was related to the fly's location compared to the cell frame. See proposed fix https://gerrit.libreoffice.org/#/c/41821/
Comment 14 Commit Notification 2017-09-02 17:35:38 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7a9fb40cb07de8c2ea33f92735be5008d30d6704

tdf#37153 ConsiderWrapOnObjPos: also affect wrap-thru objs

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2017-09-04 16:10:31 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e56f61c4637c09afbf125fa02f131b0c49e36351

tdf#37153 ConsiderWrapOnObjPos: always affect anchoring cell

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Justin L 2025-05-21 22:43:59 UTC
(In reply to Justin L from comment #11)
> In MSO, the cell vertical alignment doesn't affect the anchored object's
> placement, but in LO the object shifts as the vertical alignment is changed.

It isn't MSO per se, but whether or not a compat setting is enabled. doNotVertAlignCellWithSp.

So I need to revert these commits and instead base it on the compat flag.
Comment 17 Justin L 2025-05-22 13:54:15 UTC
For DOC format: fDontVertAlignCellWithSp (1 bit): Specifies whether to not vertically align cells containing floating objects. Specified in [ECMA-376] Part 4, 2.15.3.23 (doNotVertAlignCellWithSp). MAY be ignored. Only supported in Office Word 2007 and Word 2010.

DOCX ECMA spec says: doNotVertAlignCellWithSp (Don't Vertically Align Cells Containing Floating Objects)

This element specifies whether applications shall vertically align the contents of a table cell, even when the contents of that table cell include one or more floating objects. Note that the floating object shall be part of the cell, and simply not displayed over the cell due to its anchoring relative to another part of the document.

Typically, if the alignment of a table cell in a WordprocessingML document is specified, then the entire contents of that cell are aligned as specified [Example: The entire contents of the cell are centered vertically and moved right-aligned horizontally at that point. end example]. This element, when present with a val attribute value of true (or equivalent), specifies that whenever a floating object is present in a table cell, that no vertical alignment shall be applied to the contents of that cell, and the contents of the cell shall instead always be top aligned to the cell's contents.
Comment 18 Justin L 2025-05-23 01:20:06 UTC
I tested and it is only floating objects that affect it, not inline (AS_CHAR) objects. From what I can see, LO works the same way.
Comment 19 Commit Notification 2025-05-28 09:38:47 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/52648dbfa8ea57b164070326d9a3355b45b4e1d0

NFC tdf#37153 ww8import: replace 'unknown' with compatibility names

It will be available in 25.8.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 20 Commit Notification 2025-05-28 09:42:50 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/10b9d5200e382db5affaefc035ebe4d6b35a92fb

tdf#37153 tdf#165478 sw: add mso-compat flag doNotVertAlignCellWithSp

It will be available in 25.8.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.