I don’t know if this is related to
SLIDESJAVA-38440
but table borders aren’t being copied over correctly in clones (or at least when only the bottom border is set)
try {
String dataDir = new File(".").getAbsolutePath() + File.separator;
Presentation inPres = new Presentation(dataDir+"in.pptx");
Presentation outPres = new Presentation();
outPres.getSlides().removeAt(0);//remove first blank slide
ISlide slide=inPres.getSlides().get_Item(0);//first slide of in.pptx
ILayoutSlide inLayout=slide.getLayoutSlide();//the layout of that slide
ILayoutSlide outLayout= outPres.getLayoutSlides().addClone(inLayout);//clone of inLayout in outPres
outPres.getSlides().addClone(slide,outLayout);//clone the slide using the cloned layout
outPres.save(dataDir + "out.pptx", SaveFormat.Pptx);
}
catch( Exception e){
System.out.println("Error Exception in code: "+e.getMessage());
System.exit(1) ;
}
see attached zip for in and out
files.zip (48.7 KB)
@JamesDriscoll,
Thank you for the issue description. I have investigated the problem and got the same results. I have logged the issue in our tracking system with ID SLIDESJAVA-38458. Our development team will investigate it. You will be notified when it is fixed.
@JamesDriscoll,
In that case, Aspose.Slides repeats the cloning behavior of PowerPoint. As you can see in presentation2.zip and cloning_screen.png the result of PowerPoint 2019 and PowerPoint for Microsoft 365 is the same as Aspose.Slides.
Hi Andrey - PowerPoint for Microsoft 365 correctly clones the border as the original - if you clone the layout from in.pptx to an new presentation and then clone the slide you get this
Screenshot 2021-04-14 160417.png (26.2 KB)
@JamesDriscoll,
Unfortunately, I have not managed to reproduce the desired result in PowerPoint with layout cloning. Would you describe how you do this, please?
open in.pptx
delete presentation slide 1 (so presentation is empty and save the file as pesentation.pptx). presentation.pptx now has the master slide of in.pptx but without the presentation.
open in.pptx again, copy slide 1 and paste using destination theme into presentation.pptx
@JamesDriscoll,
Well, this scenario is different from the initial one. But I reproduced the issue and received the same incorrect result. I’ve logged the issue in our tracking system with ID SLIDESJAVA-38511. Our development team will investigate it. I will inform you about any progress.
1 Like
The issues you have found earlier (filed as SLIDESJAVA-38511) have been fixed in this update.
Sadly, the table cloning problem still persists (border styles are wrong in the clone)- I’ll try come up with a different example when time allows
public final class Test {
public static void main(String[] args) {
com.aspose.slides.License license = new com.aspose.slides.License();
license.setLicense("Aspose.Slides.Java.lic");
try {
String dataDir = new File(".").getAbsolutePath() + File.separator;
Presentation inPres = new Presentation(dataDir+"in.pptx");
Presentation outPres = new Presentation();
outPres.getSlides().removeAt(0);//remove first blank slide
ISlide slide=inPres.getSlides().get_Item(0);//first slide of in.pptx
ILayoutSlide inLayout=slide.getLayoutSlide();//the layout of that slide
ILayoutSlide outLayout= outPres.getLayoutSlides().addClone(inLayout);//clone of inLayout in outPres
outPres.getSlides().addClone(slide,outLayout);//clone the slide using the cloned layout
outPres.save(dataDir + "out.pptx", SaveFormat.Pptx);
ILayoutSlide cloneInLayout= inPres.getLayoutSlides().addClone(inLayout);//clone of inLayout in inPres
inPres.getSlides().addClone(slide,cloneInLayout);//clone the slide on the inpres
inPres.save(dataDir + "modifiedin.pptx", SaveFormat.Pptx);
}
catch( Exception e){
System.out.println("Error Exception in code: "+e.getMessage());
System.exit(1) ;
}
}
}
this is very similar code to the first post
as well as cloning the slide and layout and outputting it, the code also clones the slide and layout insitu and outputs the modified ‘in.pptx’
As can be seen in the zip “modifiedin.pptx” has mainted the borders styles of the original table
out.pptx has not
If you do not believe this is a bug, could you explain how one goes about copying the tables border styles when cloning slides from one presentation to another.
Kind Regards
James Driscoll
tableborders.zip (71.6 KB)
@JamesDriscoll,
As we explained earlier, this is not a bug. You can easily check this with PowerPoint by repeating the same cloning steps. I have done some experiments. Unfortunately, I still don’t see any workaround.
So, to be clear, you are saying there is no way in ASPOSE to copy a table from one presentation to another and maintain the border style of the original? (regardless of whether this is currently a bug in PowerPoint or not)
@JamesDriscoll,
Aspose.Slides 21.5 copies the border style correctly. Please take a look at how these files are displayed in LibreOffice: in_out.png (47.4 KB).