Bug 133847

Summary: Copying from template messed up Z-index on first page
Product: LibreOffice Reporter: Wahrendorff <his>
Component: sdkAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: normal CC: ilmari.lauhakangas, kostecki, lustig, xiscofauli
Priority: medium    
Version: 6.3.6.2 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: Sample files and Eclipse Project to reproduce the behaviour

Description Wahrendorff 2020-06-10 08:09:47 UTC
Created attachment 161828 [details]
Sample files and Eclipse Project to reproduce the behaviour

Problem description: 

We are using LibreOffice as a server for Document generation and Mass printing. It works this way: We have an odt as template. We load it into memory, replace texts in content, do some zip/xml manipulating and save it as a single odt file. 
 When the user wishes to get everything in one big file, we copy content and styles to a newly created document via UNO-API (xStyleLoader.loadStylesFromURL, xDocInsertable.insertDocumentFromURL).

In this particular case, there is inconsistency with the z-index of elements on the first page of merged documents. This is only visible when elements are overlapping. 

Z-Index of Elements in template:
* gr1 : 0
* fr1 : 1
* fr2 : 2 

Z-Index of Elements in result on first page:
* gr1 : 3
* fr1 : 1
* fr2 : 4

Z-Index of Elements in result on second page:
* gr1 : 2
* fr1 : 5
* fr2 : 6

I think we all agree that this Layout is bad practice and overlapping problems are easily solvable with simple changes in the template, nonetheless it is also a technical bug.

We made an example file and eclipse project including our Code for reproducing the problem. Also including the "template", the single temp files and resulting merged odt with the bad z-index on page 1.

I am filling this bug against 6.3.6 (Linux), since this is the version we are promoting to our customers, but it is also reproducible with newer 6.4 (Linux) and 7.0 beta 1 (Linux) versions and was originally found on Version 6.1 (Windows).
You might find the unoil, jurt, ridl, juh libs are quite old ones from Version 4 in the testproject, but I can assure there is no difference in behaviour with newer ones, we already updated and testes with them.

Greetings
Comment 1 Buovjaga 2020-11-11 10:37:07 UTC
Let's say I'm willing to test this, but don't normally use Eclipse. Please give instructions for what I should do after installing Eclipse to test your project.
Comment 2 Wahrendorff 2020-11-12 08:55:32 UTC
* Extract ZIndexMergeTest from the zip into the eclipse-workspace directory (or any directory, should not matter in this case) 
* In Eclipse, import the project (File > Import > General > Project from existing directory)
* Run src/de/his/UNOPdfExport/ZIndexMergeTest.java as Java Application. (Right clikc > Run as.. > Java Application)
* Refresh Project view to see generated files.

Prerequisites: Libreoffice needs to be installed obviously. 

Thx for looking into this.
Comment 3 Buovjaga 2020-11-12 15:51:10 UTC
(In reply to Wahrendorff from comment #2)
> * Extract ZIndexMergeTest from the zip into the eclipse-workspace directory
> (or any directory, should not matter in this case) 
> * In Eclipse, import the project (File > Import > General > Project from
> existing directory)
> * Run src/de/his/UNOPdfExport/ZIndexMergeTest.java as Java Application.
> (Right clikc > Run as.. > Java Application)
> * Refresh Project view to see generated files.
> 
> Prerequisites: Libreoffice needs to be installed obviously. 
> 
> Thx for looking into this.

I imported "Projects from folder or archive". After clicking Finish, the view does not change. Should I do this in Eclipse (where?) or in Windows file browser: "Right click > Run as.. > Java Application"?
Comment 4 Xisco FaulĂ­ 2022-05-02 12:01:50 UTC Comment hidden (no-value)
Comment 5 Conrad Kostecki 2022-05-02 15:29:43 UTC
Yes, it can be reproduced with newest version.