Bug 135595 - Image behind table on DOCX (and RTF) in footer (header)
Summary: Image behind table on DOCX (and RTF) in footer (header)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: DOCX-Header-Footer
  Show dependency treegraph
Reported: 2020-08-10 09:35 UTC by Telesto
Modified: 2023-05-19 15:50 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

Example file (672.99 KB, application/vnd.oasis.opendocument.text)
2020-08-10 09:35 UTC, Telesto
Example file (5.87 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-08-12 14:49 UTC, Telesto
tdf135595_HFtableWrap.odt: two scenarios of through wrap and optimal wrap (94.21 KB, application/vnd.oasis.opendocument.text)
2020-08-13 05:44 UTC, Justin L
tdf135595_patch.diff: wrap-through in background, but others not (1.53 KB, patch)
2020-08-13 05:55 UTC, Justin L

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-08-10 09:35:46 UTC
Image behind table on DOCX (and RTF) in footer (header)

Steps to Reproduce:
1. Open the attached file
2. Export to RTF/DOCX
3. File reload -> Notice border lines shining through the image
4. Bring image to front -> no effect

Actual Results:
Image behind table

Expected Results:
Image in front of table

Reproducible: Always

User Profile Reset: No

Additional Info:
Version: (x64)
Build ID: <buildversion>
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: ru-RU (nl_NL); UI: en-US
Calc: CL
Comment 1 Telesto 2020-08-10 09:35:59 UTC
Created attachment 164091 [details]
Example file
Comment 2 Telesto 2020-08-10 09:39:15 UTC
As I love to share; but feel free to ignore.. This is introduced in 7.0 branch. Before the issue couldn't exist, as the position of the image being converted to inside the table cell.
Comment 3 Telesto 2020-08-10 09:51:25 UTC
I noticed that the problem is pretty old actually if you export ODT to DOCX with 7.1 and open the DOCX in older versions. didn't show a table in footer. This started with 4.0 (including the wrong 'order').
Comment 4 Justin L 2020-08-12 12:30:38 UTC
This information is probably very relevant:
> tdf#48658 writerfilter: only set THROUGH wraps as transparent
> commit 15c3a08b8b1e8060f9659c7bc98480a39d1802c5 set transparency
> before the wrap type was known (which is good in case wrap type is
> never defined, and the default wrap type IS through, so that fits)
> but transparency was never re-evaluated once the wrap type was known.
> In MSWord, the header is at a lower zOrder than the body,
> so objects that are OVER the header text are still UNDER
> the body text. Writer emulates this by insisting that ALL
> through-wrapped header objects are UNDER the header text.
> (This ought to only apply to objects that spill into the
> body text area, but that’s pretty hard to calculate, so
> transparency was applied to any object anchored in the header.)

Note that it is harder in 7.1 to create this example from scratch because of:
> tdf#104596 sw COMPAT layout: wrap in header for in-table flies
> You might have noticed that text in header/footers
> will not wrap around fly frames, but just run underneath,
> regardless of the wrap settings. Strange, eh?

a.) as an older document, wrap is ignored even on table-anchored objects.
b.) and thus the default "through" wrap is forced into the background.
c.) this could presumably be marked as "fixed in 7.1" for newly created docs.

Therefore, I don't think much can or should be done about this bug report.

My concern still is that the wrap status doesn't show "in background" even though it acts like it. (And I guess that makes sense because this is all "layout emulation" and so the actual properties are not changed.) But why does changing from "none" to "in background" actually set to "through"? (Well, it is probably a combination of wrap+opaque settings, and this just toggles WrapTextMode_THROUGH between opaque and transparent. (sw/source/uibase/shells/basesh.cxx)

Since this is unconfirmed so far, and no one else has commented, I'll immediately mark it as WONTFIX, but feel free to change that.
Comment 5 Telesto 2020-08-12 12:43:38 UTC
Not deeply invested in this bug, so not caring to much. However..

Only to observations
A) Such a document can be easily created from scratch (not getting C)
B) Why this is working normal document area, but only failing in the foot/header area. Naive me assumes both things be the same, IMHO
Comment 6 Justin L 2020-08-12 14:16:08 UTC
(In reply to Telesto from comment #5)
> A) Such a document can be easily created from scratch
OK. I don't know what I was testing earlier, but I agree - still easy to create.

> B) Naive me assumes both things be the same, IMHO
In an ancient effort to be compatible with MS strangeness,
OOo decided to do this (ignore wrapping) as well for interoperability reasons.

However, stuff anchored in tables is supposed to have wrapping turn on, so why is LO still marking it as transparent? The picture I anchored in a header table is causing body text to wrap, so it shouldn't be background... I need to research that...
Comment 7 Telesto 2020-08-12 14:49:12 UTC
Created attachment 164211 [details]
Example file

Same, similar behavior.. but also in document.. Every wrap is thrown out the window, to be wrap through..

1. open file
2. Change wrap
3. Save & reload
Comment 8 Justin L 2020-08-13 05:44:04 UTC
Created attachment 164227 [details]
tdf135595_HFtableWrap.odt: two scenarios of through wrap and optimal wrap

Through wrap: should always be in the background - otherwise it could obscure text in the body - which would never happen in Word.

Optimal wrap: conceivably COULD be kept in the foreground, since body text will wrap around it. However, it would interfere with any other non-text elements in the body. In Word, it would be behind those objects.

REMINDER: table anchor supposedly has different rules which allow the wrapping inside the header, although that doesn't seem true with this document. Worth noting that any changes made in Word 2003 wants to dump the image inside of the table (layout in table), and Word2016 actually does that on import.
Comment 9 Justin L 2020-08-13 05:55:23 UTC
Created attachment 164230 [details]
tdf135595_patch.diff: wrap-through in background, but others not

So, because there doesn't seem to be a good answer and everything about table-anchored items (especially in headers) is goofy, I won't actually submit any patch for this, but it is at least a good code pointer.

It fixes this particular bug report anyway.
[Attachment 164211 [details] - ss2.odt - is a completely different, unrelated bug.]
Comment 10 QA Administrators 2022-12-04 03:50:27 UTC Comment hidden (spam)