Use Potx as a template for newly generated presentation

Hi,


I am new to aspose.slides, what i want to do is i have a ‘presentation.potx’ file and there are 8 different layouts 1. main layout which is main page of the prentation which contain title and other things and a different header from other pages. There are few more layouts which has textframes for images, charts etc. i want to use this as a template for newly generated presentation and keep main page as same with different title and rest all pages as per the layouts in the template.

Thanks in advance,
Amey

Hi Amey,


Thanks for inquiring Aspose.Slides.

I have observed your requirements and like to share that you can load the PPTM using Presentation class exposed by Aspose.Slides. You can clone master slide/slides from PPTM to target presentation and may apply any layout from cloned master of PPTM to any slide in target presentation. I request you to please visit this documentation link to serve the purpose on your end. I hope this will be helpful. Please share, if I may help you further in this regard.

Many Thanks,

Hi Mudassir,


I am using following code to copy layouts from src presentation i.e. potx to des presentation i.e. newly created one:

//BOC - Code to copy all layouts from src to des
foreach (Aspose.Slides.MasterSlide master in src.Masters)
des.Masters.AddClone(master);
//EOC - Code to copy all layouts from src to des

i am able to copy all the layouts but if want some layout to be the first page of the presentation then how to do that and how to identify which text frame is the tittle of the slideshow.?

Let me know if am following correct approach or is there any better way of doing this.

Thanks and Regards,
Amey

Hi Amey,

I have tried to understand your following comments but have not been been able to understand them properly.

ameysawant:
i am able to copy all the layouts but if want some layout to be the first page of the presentation then how to do that and how to identify which text frame is the tittle of the slideshow.?


Can you please share more details about this. I request you to please share the source presentation, source Potx and desired output presentation. I will investigate your requirements based on shared presentation decks to help you further in this regard.

Many Thanks,

Hi Mudassir,


Thanks for reply, currently i am browsing through aspose.slides my requirement is such that i have a template which has number of slide layouts in it for e.g. one among them is the main front/first page layout.

ill categorize my requirements in parts
1. Now i want to generate a presentation which should contain all the layouts from the template.I want the first layout of the template to be the layout for the first slide in the presentation.
2. In the first layout of the template there are text frames and one of the text frame is for the title of the document, now when i am using this template for generating the presentation i want the title of the presentation to be displayed in the text frame which can be done only if through code i can identify that the layout has text frame for title.

can this be done using aspose.slides?

Regarding source presentation you can consider any presentation and potx.

Thanks and Regards,
Amey

Hi Mudassir,


I have a template and want to generate presentation from the template. Template contains the parts like title of the presentation etc.

I have data to be filled in the presentation, how will i identify the parts as a title or chart or body text etc.

Thanks and Regards,
Amey

Hi Amey,

I have observed your two responses. In first post, you have inquired that if there is some layout slide in template presentation, how you will get that to target presentation. I like to share that layout slides actually belong to some master slide. When you clone the master from any presentation then all corresponding layout slides in that master also gets cloned to target presentation.

Once you set a layout slide belonging to given master slide to any slide in your presentation, the template placeholder belonging to used layout slide will get applied to target slide. You may please try following sample code on your end to get the placeholder type for any shape and perform the desired action. You may please use the code as reference and may develop your implementation based on shared idea.

public static void testplaceholder()
{
using (Presentation pres = new Presentation(“welcome.pptx”))
{

//Access first slide
ISlide sld = pres.Slides[0];

//Iterate through shapes to find the placeholder
foreach (IShape shp in sld.Shapes)
if (shp.Placeholder != null)
{
if (shp.Placeholder.Type == PlaceholderType.Title)
{
//Title
}
else if (shp.Placeholder.Type == PlaceholderType.Subtitle)
{
//Sub title
}

else if (shp.Placeholder.Type == PlaceholderType.Chart)
{
//Chart
}
}

//Save the PPTX to Disk
pres.Save(“welcome_PH.pptx”, SaveFormat.Pptx);
}
}


Many Thanks,

Hi Mudassir,


Thanks a lot for your reply. I am using same method.

Regards,
Amey