Dear all, I'm working with Apache POI and I would like to duplicate a slide containing several charts from code (this slide is a "template" that will be used with dozens of datasets with the same structure).
The code below (inspired by https://poi.apache.org/slideshow/xslf-cookbook.html#Merge) works fine when there is no chart on the slide. Unfortunately, it seems that the charts are not duplicated with this method: when I try to open the resulting file, Powerpoint detects a problem, tries to repair it, but fails, and I get empty slides. I've checked the underlying XML files (using Open XML SDK), and it seems that the chart themselves (in the folder /ppt/charts) are not duplicated, and the relationship files (in the folder /ppt/slides/_rels) are not completely updated. Here is my current code: // Open slideshow FileInputStream fileInputStream = new FileInputStream(sourceFilePath); XMLSlideShow slideShow = new XMLSlideShow(fileInputStream); fileInputStream.close(); // Duplicate slide XSLFSlideLayout layout = slide.getSlideLayout(); XSLFSlide newSlide = slideshow.createSlide(layout); newSlide.importContent(slide); // Save updated slideshow FileOutputStream fileOutputStream = new FileOutputStream(outputFilePath); slideShow.write(fileOutputStream); fileOutputStream.close(); Do you know how I could clone a slide and its charts ? I've also found a way using JACOB and COM components, but I'm not really happy with it. Remark: I have also posted this question on StackOverflow: http://stackoverflow.com/questions/35431714/how-to-duplicate-a-slide-containing-a-chart-using-apache-poi Thanks a lot, and best regards! -- Romain André-Lovichi
