Clone - table shifted to top left corner?

Hello,
We’re trying to clone the masters from one presentation “SamplePpt” to another ppt “DocletPpt”. If we’ve a master with same name present in DocletPpt, we’re cloning SamplePpt’s master and adding additional doclet layouts to it and add it finally to DocletPpt, and delete the older one from DocletPpt. We also change all slides base layouts.


Issues: In “Doclet_After_Application.pptx
#1. On Slide 2, there is a table - but it’s invisible in MS Office 2010 and 2013.
#2. The slide 2 table shifted to “top -left” corner. It’s visible in MS Office 2007.

Please look into these two issues, and find the attached presentation.

Here is the code:

Code:
public void bug() {
String dirUrl = “\Desktop\Merge\”;
String docxName = “SamplePpt.pptx”;
String doclet = “DocletPpt.pptx”;
Presentation sample = new Presentation(dirUrl + docxName);
Presentation dclt = new Presentation(dirUrl + doclet);

formattingApplication(dclt, sample);

dclt.save(dirUrl + “Doclet_After_Application.pptx”, SaveFormat.Pptx);
}

static IMasterSlide getMasterByName(final IMasterSlideCollection presentationMasters, final String masterLookUp) {


final IMasterSlideCollection pptMasters = presentationMasters;

IMasterSlide desired = null;
for (IMasterSlide master : pptMasters) {
if (masterLookUp.equals(getMasterName(master))) {
desired = master;
break;
}
}
return desired;
}

static ILayoutSlide getLayoutByName(final IMasterSlide master, final String layoutName) {
ILayoutSlide layout = null;
for (final ILayoutSlide layoutAttached : master.getLayoutSlides()) {
if (layoutAttached.getName().equals(layoutName)) {
layout = layoutAttached;
break;
}
}
return layout;
}

void formattingApplication(Presentation loadedPresentation, Presentation sampleTemplate) {
final IMasterSlideCollection loadedMasters = loadedPresentation.getMasters();

// Hard coding the Office Theme, as both SamplePpt and DocletPpt has Office Theme master. Just one master
IMasterSlide actualMaster = getMasterByName(loadedMasters, “Office Theme”);
IMasterSlide sampleMaster = getMasterByName(sampleTemplate.getMasters(), “Office Theme”);

IMasterSlide finalMaster = loadedMasters.addClone(sampleMaster);

for (final ILayoutSlide actualMasterLayout : actualMaster.getLayoutSlides()) {
if (getLayoutByName(finalMaster, actualMasterLayout.getName()) == null) {
finalMaster.getLayoutSlides().addClone(actualMasterLayout);
}
}

for (final ILayoutSlide actualMasterLayout : actualMaster.getLayoutSlides()) {
if (actualMasterLayout.hasDependingSlides()) {
final ILayoutSlide finalMasterLayout = getLayoutByName(finalMaster, actualMasterLayout.getName());
if (finalMasterLayout == null) {
throw new IllegalStateException(“The layout should be present in final master!”);
}

final ISlide[] basedSlides = actualMasterLayout.getDependingSlides();

if (basedSlides == null || basedSlides.length == 0) {
throw new IllegalStateException(“Aspose told there are some depending slides!”);
}

for (final ISlide slide : basedSlides) {
slide.setLayoutSlide(finalMasterLayout);
}

if (actualMasterLayout.hasDependingSlides()) {
throw new IllegalStateException(“Dependencies should be resolved!”);
}
}
}


// final master is all set for ruling new world and
// old actual master is relieved!
loadedMasters.remove(actualMaster);
}

static String getMasterName(final IMasterSlide master) {
return master.getThemeManager().getOverrideTheme().getName();
}

Thanks,
Prakhar

Hi Prakhar,


I have observed the requirement shared by you and have found that you are actually cloning the layout slides and applying the layout from new master to presentation slides. I have opened the source and generated presentations in PowerPoint 2010 and have not been able to trace the issues. Can you please share the comparison snapshot of two presentation files side by side and highlight issue incurring on your end. Please also share the version of PowerPoint with which you are able to reproduce the issue on your end. I will be able to investigate the issues further on my end once the requested information will be shared.

Many Thanks,

Hi Prakhar,


Thank you very much for sharing the feedback. I suggest you to please try using Aspose.Slides for Java 15.5.1 on your end first. Are you using the specified version? If not then please share the specified version and share your kind feedback with us.

Many Thanks,

I was using 15.3.0, but checked with 15.5.1 version as well, and the problem still persists with 15.5.1 version. Thanks in advance.

Hi Prakhar,

Thank you for sharing the additional details. I have observed the issue and have created a ticket in our issue tracking system with ID SLIDESJAVA-34935 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,

The issues you have found earlier (filed as SLIDESJAVA-34935) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.