Bug 36711 - FILOPEN .DOC Wrap around frame positions wrong, horizontal relative to Page, vertical relative to Paragraph (MSO opens wrong self saved DOCX)
Summary: FILOPEN .DOC Wrap around frame positions wrong, horizontal relative to Page, ...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: Other All
: low normal
Assignee: Justin L
Whiteboard: target:7.6.0
Depends on:
Blocks: DOC-Frames
  Show dependency treegraph
Reported: 2011-04-30 07:21 UTC by Greg Smith
Modified: 2023-05-29 15:16 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

Word document that nearly imports correctly (89.50 KB, application/msword)
2011-04-30 07:21 UTC, Greg Smith
first attachment, saved as pdf using msWord 2007 (136.58 KB, application/pdf)
2012-09-04 08:32 UTC, sasha.libreoffice
.doc compared MSO LO (211.18 KB, image/png)
2019-10-11 09:17 UTC, Timur
Original .doc file exported as .docx by Word 2010 and removed a few images (59.58 KB, application/xml)
2021-12-01 20:28 UTC, Greg Smith
winsig34_Min.doc: three frames - two (with styles Margin/Heading3) are wrongly positioned (36.50 KB, application/msword)
2023-05-27 21:17 UTC, Justin L
133504_dump.doc:doc_dumper sprm details of the internal guts (374.00 KB, application/msword)
2023-05-27 23:21 UTC, Justin L
winsig34_MinB.doc: Heading 3 is Entire page, instead of Page margin (36.50 KB, application/msword)
2023-05-29 15:16 UTC, Justin L

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Smith 2011-04-30 07:21:41 UTC
Created attachment 46192 [details]
Word document that nearly imports correctly

The attached Word document gets close to being imported correctly. The main fault is that the headings in the margins sometimes do not get the correct positions. This can be corrected by selecting the malpositioned heading and changing the Frame settings Vertical positions from 1.34" Entire page to 0" Margin (the setting that correctly imported heading are set to).

The very first heading has this problem, as do others in the document.

I would very much like to change my company over to using LO from Word, but the treatment of these side-by-side (marginalia) heading is a show-stopper.

There are other faults related to paragraph spacing and text flow.
Comment 1 Björn Michaelsen 2011-12-23 12:02:34 UTC Comment hidden (obsolete)
Comment 2 Greg Smith 2012-01-04 14:28:44 UTC
I have tried the document with the latest beta. The import of this document is now WORSE than before. The side-by-side frame with the header is no longer in the margin, where it was correctly placed before. The headings being on top of each other still remains as a bug.

Perhaps this document could be drawn to Miklos's attention... as according to a recent blog entry for the project, he is looking for import documents.
Comment 3 Florian Reisinger 2012-08-14 13:57:54 UTC Comment hidden (obsolete)
Comment 4 Florian Reisinger 2012-08-14 13:59:13 UTC Comment hidden (obsolete)
Comment 5 Florian Reisinger 2012-08-14 14:03:47 UTC Comment hidden (obsolete)
Comment 6 Florian Reisinger 2012-08-14 14:06:02 UTC Comment hidden (obsolete)
Comment 7 sasha.libreoffice 2012-09-04 08:32:42 UTC
Created attachment 66600 [details]
first attachment, saved as pdf using msWord 2007
Comment 8 sasha.libreoffice 2012-09-04 08:33:29 UTC
reproduced in 3.3.4 and 3.6.1 on Fedora 64 bit
Comment 9 QA Administrators 2015-04-19 03:20:41 UTC Comment hidden (obsolete)
Comment 10 Greg Smith 2015-04-19 11:21:14 UTC
Bug still exists in with Windows 7.

Please not that this is not a NEEDSINFO bug... the submitted document shows the problem and has always done so.
Comment 11 QA Administrators 2016-09-20 09:32:53 UTC Comment hidden (obsolete)
Comment 12 Thomas Lendo 2017-12-04 21:25:02 UTC
Still repro in

Build ID: 2618e4a13d719122e6358d9d96864d1691e56a02
CPU threads: 4; OS: Linux 4.10; UI render: default; VCL: gtk3; 
Locale: de-DE (de_DE.UTF-8); Calc: group threaded
Comment 13 QA Administrators 2018-12-05 03:48:41 UTC Comment hidden (obsolete)
Comment 14 Timur 2018-12-05 11:45:09 UTC
Repro 6.3+.
Title "FILOPEN import of Word side-by-side heading superimposes headings" changed to the cause "FILOPEN .DOC Wrap around frame positions wrong, horizontal relative to Page, vertical relative to Paragraph".

Note: headings content is wrong in Word 2016.
Comment 15 Timur 2019-10-11 09:17:23 UTC
Created attachment 154927 [details]
.doc compared MSO LO

This .DOC looks wrong in LO 6.4+. 
But if resaved in MSO as DOCX, it opens wrong in MSO (and expectedly in LO).
I decrease a priority.
Comment 16 QA Administrators 2021-10-11 03:32:05 UTC Comment hidden (obsolete)
Comment 17 Greg Smith 2021-12-01 20:28:25 UTC
Created attachment 176639 [details]
Original .doc file exported as .docx by Word 2010 and removed a few images

This document fails in LibreOffice 7.2 in much the same way. The side-by-side headings in the Word doc (which works fine in Word) are a mess in LO.

In Word it was easy to set a style to set a frame and a paragraph style that generated the side-by-side effect. This appears not to be easy at all in LO.
Comment 18 Justin L 2023-05-27 19:08:56 UTC
The described problem has basically been fixed in LO 7.6 with
commit 630732bfd8ed531e9d412a36a083f33763def054
Author: Justin Luth on Sat Mar 11 13:16:56 2023 -0500
    tdf#112287 tdf#154129 writerfilter framePr: fix vAnchor default
Comment 19 Justin L 2023-05-27 19:22:56 UTC
Whoo boy - let me qualify that statement. It was fixed for DOCX (comment 17).

It is not fully fixed for DOC format. It was partially fixed in 7.6 with https://gerrit.libreoffice.org/c/core/+/152331.
Comment 20 Justin L 2023-05-27 21:17:17 UTC
Created attachment 187548 [details]
winsig34_Min.doc: three frames - two (with styles Margin/Heading3) are wrongly positioned
Comment 21 Justin L 2023-05-27 23:21:32 UTC
Created attachment 187552 [details]
133504_dump.doc:doc_dumper sprm details of the internal guts

There must be some kind of default value that is wrong here.

When I created a DOCX of this file, I get
Margin3 (based on Heading3): <w:framePr w:wrap="auto"/>
Heading 3 (based on Heading2): <w:framePr w:wrap="auto"/>
Heading 2: <w:framePr w:w="2520" w:wrap="auto" w:vAnchor="text" w:hAnchor="text" w:x="-2807"/>

In DOCX, these would all inherit the defined w:vAnchor from Heading 2,
but in DOC it looks different.
Margin3: specifies nothing - inherits everything from Heading 3
Heading 3: specifies 1000 0000 = H:Entire Page, V:Page Margin

So, I'm not sure why MS Word would treat that as paragraph, unless it is because sprmPDyaAbs == 0 as a corner case? Ah, yes, that is likely because 0 has a special meaning of inline.

"Inline (in line with text):
 Specifies that the parent object shall be vertically
 aligned in line with the surrounding text (i.e. shall not
 allow any text wrapping around it when positioned in the document."
Comment 22 Commit Notification 2023-05-29 15:09:36 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":


tdf#36711 doc import: special case when DyaAbs is zero

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

Affected users are encouraged to test the fix and report feedback.
Comment 23 Justin L 2023-05-29 15:16:25 UTC
Created attachment 187584 [details]
winsig34_MinB.doc: Heading 3 is Entire page, instead of Page margin

just to confirm that a DyaAbs of 0 also overrides a PositionCodeOperand pcVert of 1 (entire page) [since my testing was with 0 (page margin)] I hexedit'ed Heading 3 to become 90 instead of 80. Indeed, in MS Word 2010 the vertical is based on paragraph, not page margin.

Two of the three frames are based on Heading 3 (one by inheritance).