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

Free Support Forum - aspose.com

PPTX Template Sample

Hi..

Do you have an example of your TEMPLATE sample using a PPTX?

thanks in advance

Hi,

Thanks for your interest in Aspose.Slides.

Below is the code example in C#.


string sourceName = @"C:\source.pptx";
string templateName = @"C:\template.pptx";

//Source presentation
PresentationEx sourcePres = new PresentationEx(sourceName);

//Template presentation
PresentationEx templatePres = new PresentationEx(templateName);

//Template slide
SlideEx templateSlide = templatePres.Slides[0];

//Get the template master from template slide
MasterSlideEx templateMaster = templateSlide.LayoutSlide.MasterSlide;

//Copy template master into source presentation
int sourceMasterIndex = sourcePres.Masters.AddClone(templateMaster);
//Access the compy of template master from source presentation
MasterSlideEx sourceMaster = sourcePres.Masters[sourceMasterIndex];

//Change master of all source slides
foreach (SlideEx slide in sourcePres.Slides)
{
slide.LayoutSlide.MasterSlide = sourceMaster;
}
//Write source presentation output on disk
sourcePres.Write(@"C:\output.pptx");

I hope this info will help you in this regard.


Is the replacement for Aspose.Slides.WF.Template?


System.IO.FileStream fis = new System.IO.FileStream(MapPath(".") + “\demo.ppt”, System.IO.FileMode.Open, System.IO.FileAccess.Read);
Presentation pres = new Presentation(fis);
fis.Close();

Slides slides = pres.Slides;
for (int i=0; i<slides.Count; i++)
{
// Set text of standard slide placeholders
Placeholders pholders = slides[i].Placeholders;
for (int j=0; j<pholders.Count; j++)
{
TextHolder th = pholders[j] as TextHolder;
if (th != null)
{
if (th.Text == “H1”)
th.Paragraphs[0].Portions[0].Text = “Demo Presentation”;
else if (th.Text == “SH1”)
th.Paragraphs[0].Portions[0].Text = “Aspose.Slides.Template”;
else if (th.Text == “T1”)

Hi,

Thanks for your interest in Aspose.Slides.

Please follow the following link which will also help you.


http://www.aspose.com/demos/.net-components/aspose.slides/csharp/general/create-from-template.aspx


If you require any further information, please feel free to contact us.

Many Thanks

This the code for the PPT.

How do I do the same with PPTX ? that does not have placeholders.
thanks

Hi Jon,

Thanks for your interest in Aspose.Slides,

I think you have created a new post with most relevant title, If you still want to follow up this query, Please let me know if I can be of any further help,

Thank you!