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

Free Support Forum - aspose.com

Issues with cloning of layouts in ASPOSE SLIDES JAVA 15.5.0

Hi,



I am seeing an issue in APSOSE SLIDES JAVA 15.5.0. I am trying to add layouts of destination powerpoint to source powerpoint. The font and font size gets changed of a layout when its added to source powerpoint.

The layout name of layout whose font got changed is : Title, Text, and 2 Content.

The code used is given below:

public void testMergeLayouts() {

Presentation dest = new Presentation( “Nasa FY13AnnualReport_V4.pptx”);
Presentation src = new Presentation(“Q1FY2012.pptx”);
for (IMasterSlide slide : dest.getMasters()) {
for (ILayoutSlide layout : slide.getLayoutSlides()) {
src.getMasters().get_Item(0).getLayoutSlides().addClone(layout);
}

}

src.save(“MergeLayouts.pptx”, SaveFormat.Pptx);
}

The powerpoint used are attached with this post for your reference.

Thanks,
Manisha

Hi Manisha,

I have observed the requirements shared by you and like to share that you are trying to clone the layout slide from one master of one presentation to master of another presentation. Actually, fonts and styles can be inherited from presentation level to master slide level and from master slide level to layout slide level. So, when you will clone the layout slide it will inherit the font and styling scheme of the master in which it is cloned. This is not an issue but a logical behavior. If it is necessary to save all styles of desired layout slide the you need to clone the master slide that will contain the desired font styling. I hope this will clear the concept. Please share, if I may help you further in this regard.

Many Thanks,

Hello,
This is nice information. Please add it in Javadocs so that it will save sometime for future users.

#1. Could you please tell us what else is not cloned when cloning the layouts?
#2. What APIs Aspose.Slides provides for fetching font and styling from layout and applying those after applying. We don’t want to clone the entire master in this case, since master with same name already exists in another presentation. We’re just trying to add additional layouts in master in another presentation. We want to keep everything from source presentation layout. I understood this by clone layout.


Thanks,


Hi Manisha,

I have observed your comments and like to share that we will include the information in java docs. Secondly, I like to share that that layout slide inherits fonts, styling and color scheme of Master slide.

In response to your third question, I like to share that logical behavior for the text inside layout slides for a master slide is to obey the color scheme, font and styling of Master slide. So, if there is need of one change, its made changed on master level and every layout slide and every normal slide following the layout out inherits the same feature. This is the sole purpose of using Master and layout slides. If it is intended to have separate font and styling property for a layout slide inside a master slide that is in contradiction with master slide, then better approach is to use separate master with desired layout slides following the desired font and styling properties.

If it is still intended to change the font and styling of cloned layout slide to that of source master, then you need to traverse through source layout slide shapes and apply the paragraph and portion properties for respective shapes in cloned layout slides. You have to devise your own mechanism to achieve this behavior as API does not provide such support. You can copy the paragraph and portion properties from source layout slide shape to cloned layout slide shape by visiting this article. Please note that you have to traverse through every shape textframe’s paragraph and portion inside slide and then copy the respective properties from source layout slide shape text frame paragraph and portion and apply them. I hope you understand the concept.

Many Thanks,