Bug 60662 - Slide import delete unrecognized elements in group shape
Summary: Slide import delete unrecognized elements in group shape
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: 3.16-dev
Hardware: PC All
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-30 10:39 UTC by Aurélien
Modified: 2017-02-18 01:09 UTC (History)
1 user (show)



Attachments
Minimal project to reproduce the bug. (24.39 KB, application/x-zip-compressed)
2017-02-14 16:35 UTC, Dmitry Pelevin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aurélien 2017-01-30 10:39:57 UTC
If I try to import a slide that contains a group of shapes, these contained shapes will lost all the properties that are not handled by POI: shadow (and everything in a:effectLst) etc.

However, if contained shapes are ungrouped, then these non-handled properties are kept and all is working fine.

The issue comes from XSLFGroupShape.copy(source): it removes all its shapes and reconstruct it all. Whereas in XSLFSheet.importContent(), all the shapes are kept but just "updated", not removed and recreated.

Is there a reason why the implementation of XSLFGroupShape.copy(source) is not the same as XSLFSheet.importContent():
XSLFGroupShape gr = (XSLFGroupShape)src;

List<XSLFShape> tgtShapes = getShapes();
List<XSLFShape> srcShapes = gr.getShapes();
for(int i = 0; i < tgtShapes.size(); i++){
    XSLFShape s1 = srcShapes.get(i);
    XSLFShape s2 = tgtShapes.get(i);

    s2.copy(s1);
}


If I try to use this implementation all is working as expected. However I wonder, did I miss something?
Comment 1 Dmitry Pelevin 2017-02-14 16:35:47 UTC
Created attachment 34756 [details]
Minimal project to reproduce the bug.

Please check this maven project to reproduce the bug.

You can run it with "mvn clean package && mvn exec:java".

It will insert slide from "src\main\resources\source.pptx" to "src\main\resources\template.pptx" and output will be generated as "merged.pptx" in the current directory.
Comment 2 Andreas Beeker 2017-02-18 01:09:17 UTC
Patched via r1783486

Thanks for the example files.