We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is there a way to find layout and clone the slide without iteration?

Hi,

I am first finding the layout from the theme file then I am cloning the slide but I am doing this by using iteration as mentioned below :

String masterName = "Master"
String selectedLayoutName = "Content";
boolean layoutFound = false;
boolean masterFound = false;
ILayoutSlide layout = null;
IMasterSlideCollection masters = themeFile.getMasters();
int numMasters = masters.size();
outer:
for(int j = 0; j < numMasters; j++) {
  IMasterSlide master = themeFile.getMasters().get_Item(j);
  System.out.println("master name" + master.getName());
  if(master.getName().equals(masterName)) {
masterFound = true;
IMasterLayoutSlideCollection layouts = master.getLayoutSlides();
int numLayouts = layouts.size();
for(int i = 0; i < numLayouts; i++) {
  layout = layouts.get_Item(i);
  String name = layout.getName();
  System.out.print(name);
  if( name.equals(selectedLayoutName) ) {
    layoutFound = true;
    System.out.println(" found");
    break outer;
  }
  else {
System.out.println();
  }
}
	break;
  }
} 
  1. I want to know do aspose slide java provide feasibility to check do master or layout present in theme file with it’s name without any iteration?
  2. Is there any other solution for better performance rather than looping?

Thanks,
Saquib Shaikh.

@saquibs,

There is no other way then to iterate and find particular layout inside a master slide of a theme.