Dear Team,
Our requirement is to create new pptx file from existing pptx. Existing pptx slide has one chart. So we are cloning this slide to new pptx.
Whenever we create a new pptx file, first slide comes automatically by aspose. We dont require this slide. So, we are removing this firstslide (using remove() method), but chart format is also changing automatically.
Code:
private static void croppptxchart(String inpptx, String outpptx) {
File xfile= new File(outpptx);
FileOutputStream fos;
try {
fos = new FileOutputStream(xfile);
PresentationEx newpptPresentationex=new PresentationEx();
PresentationEx pptPresentationex= new PresentationEx(inpptx);
SlidesEx oldslides = pptPresentationex.getSlides();
SlideEx oldslide = oldslides.get_Item(0);
SlidesEx newslides = newpptPresentationex.getSlides();
newslides.addClone(oldslide);
// newslides.removeAt(0); (When we remove slide by uncommanding this line, default slide is deleted and also format is changes)
newpptPresentationex.write(fos);
fos.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
We used aspose 2.9.6, the chart format is not changed. This is the problem with Aspose 3.0 version only.
We attached input,output and java file also
Input File : input_1.pptx
O/p File : output_1.pptx (This pptx has default slide and chart format is not changed)
O/p File : output_2.pptx (Default slide is removed and chart format is chaged)
Java File : POCII.java