Hi,
after merging two presentations (adding slide from b.ppt to a.ppt) the call to changeMaster results in a wrong layout of slide b.
Presentation presentationA = new com.aspose.slides.Presentation(new FileInputStream(“d:/a.ppt”));
Presentation presentationB = new com.aspose.slides.Presentation(new FileInputStream(“d:/b.ppt”));
FileOutputStream fos = null;
try {
final SortedList sl = new SortedList();
final Slide slideB = presentationB.getSlideByPosition(1);
final Slide clonedSlide = slideB.getParent().cloneSlide(
slideB,
presentationA.getSlides().getCount() + 1,
presentationA,
sl);
clonedSlide.changeMaster(presentationA.getMainMaster());
// clonedSlide.changeMaster(presentationA.getMainMaster(), true, true);
fos = new FileOutputStream(new File(“d:/ab_with_changed_master.ppt”));
presentationA.write(fos);
} finally {
fos.close();
}
Please explain what exactly cloneSlide and changeMaster do in regards to its masters and layouts. How does “changeMaster” know which will be the new layout?
best regards,
D.Croe
Hi D.Croe,
public static void genClone() throws Exception{Presentation presentationA = new com.aspose.slides.Presentation(new FileInputStream(“c:/Presentations/a.ppt”));Presentation presentationB = new com.aspose.slides.Presentation(new FileInputStream(“c:/Presentations/b.ppt”));FileOutputStream fos = null;try {// final SortedList sl = new SortedList();final ISlide slideB = presentationB.getSlides().get_Item(0);presentationA.getSlides().addClone(slideB,presentationA.getMasters().get_Item(0));// clonedSlide.changeMaster(presentationA.getMainMaster(), true, true);fos = new FileOutputStream(new File(“c:/Presentations/ab_with_changed_master.ppt”));presentationA.save(fos,SaveFormat.Ppt);} finally {fos.close();}}
Hi D.Croe,
public static void genClone() throws Exception{Presentation presentationA = new com.aspose.slides.Presentation(new FileInputStream(“c:/Presentations/a.ppt”));Presentation presentationB = new com.aspose.slides.Presentation(new FileInputStream(“c:/Presentations/b.ppt”));FileOutputStream fos = null;try {// final SortedList sl = new SortedList();final ISlide slideB = presentationB.getSlides().get_Item(0);presentationA.getSlides().addClone(slideB,presentationA.getMasters().get_Item(0));// clonedSlide.changeMaster(presentationA.getMainMaster(), true, true);fos = new FileOutputStream(new File(“c:/Presentations/ab_with_changed_master.ppt”));presentationA.save(fos,SaveFormat.Ppt);} finally {fos.close();}}
Hi Mudassir,
thanks for the ppt file, but i do not understand the master(and layouts) in this result.
a.ppt and b.ppt only have 1 layout each and the result has 11 layouts!?
Slide b looks better now, but the corresponding layout doesn't have the title in green, thus where is the green color defined than?
Seems like Slide A and B uses layout at Position 6, how are the layouts chosen?
could you please explain how this "merging magic" works?
best regards,
D.Croe
Hi D.Core,
I have observed the presentation with upcoming merged API for Aspose.Slides for Java that provides single interface for both PPT and PPTX presentations. Actually, the PPT presentations have Slide Master where as the PPTX presentations have Master with Layout slides internally. The new upcoming API is based on PPTX format with support of PPT in it. This extra layouts generated for cloned presentation seems to be an issue. I have created an issue with ID SLIDESJAVA-34394 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.
We are sorry for your inconvenience,