You may find a summary at the end.
ODF applications involved
I have created a test document with Microsoft Office Professional Plus 2016 installation, Version 1705 (Build 8201.2102) to be able to have as well DOCX functionality at hands.
Aside I have been using a LibreOffice 184.108.40.206 Writer both on a Windows 10 Home edition.
Test document description
The test document contains four images and fill text to place two images before and two behind it.
The images had been created with Microsoft PAINT. I simply have manually written "very behind", "behind", "before" and "very before" on them.
[I was slightly reminded of some Sesame Street lessons from childhood]
Creating the test document (in Word 2016)
I have added those images in Word via Insert->Pictures into the text and used the context menu on the image choosing "Wrap Text" for two images with following "Behind Text" and for the two others "in Front of Text". The images were manually positioned to be overlapping, to see which one is above the other and sometimes I have corrected the wrong Z positioning again via the context menu on the image choosing "Bring to Front" or "Sent to Back".
After this, I have saved the document as DOCX and ODT.
NOTE: I am never able to edit XML files and save them within the office document with JEdit as I do with documents from other ODF applications when they are created by any Microsoft office. Therefore I had to neglect XML face-lifting. For instance, incidentally I had duplicated the "very behind" picture during a text copy, so there are 5 pictures in total.
XML of original Microsoft Document
As we expected the higher the draw:z-index the higher the altitude, raising finally over the image:
@draw:z-index="251658240" <=> very behind
@draw:z-index="251674624" <=> very behind
@draw:z-index="251677696" <=> behind
@draw:z-index="251678720" <=> before
@draw:z-index="251679744" <=> very before
As expected, the images behind the text a graphic style use
and those before the text a graphic style have
XML of imported MSO document within LibreOffice (and saved as ODT)
Both documents in ODT and DOCX being loaded into LibreOffice 220.127.116.11 Writer look fine regarding the Z positioning, showing the same relations.
When the document is being saved as ODT again by the LO Writer it keeps its relation still changes the Z positioning to
@draw:z-index="0" <=> very behind
@draw:z-index="1" <=> very behind
@draw:z-index="2" <=> behind
@draw:z-index="3" <=> before
@draw:z-index="4" <=> very before
and ONLY the images behind have an attribute
@style:run-through, which contains at least as expected "background"
Roundtrip Interoperability Issues
When this document is again being loaded with Word, strangely the order remains mostly the same, BUT the two very bottom pictures are becoming the two top pictures AND all images are behind the text. Strange bug!
Missing Test Coverage
NOTE: I have only more or less quickly tested the z-index for images within frames and not have tested any other frame content, nor did I tested on of the other 21 elements:
<draw:regular-polygon> 10.3.6 and
Summary: A handful of things to point out
- We need more test documents to have a better coverage: Does some office vendors have a test base on this feature property they might be able to share?
- Only the ordering of the z-index values are of interest, not the values itself
- As expected style:run-through="background" is being used to emulate a negative z-index.
- If we do not want to improve the z-index as Dough suggested, we might still want to make the value "foreground" the default value of @style:run-through
- There is an interoperability issue when loading the Word document with Writer than saving it as ODT and loading it back with Word: The two pictures at the very bottom are now at the very top.