Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Tue Dec 18, 2018 5:16 pm

Hi,

I want to create slides using a custom template. Does Spire support that? If yes, how? Any help is greatly appreciated!

mohitnandkishore.kanojia@globalfoundries.com
 
Posts: 8
Joined: Mon Dec 17, 2018 9:21 pm

Wed Dec 19, 2018 8:41 am

Hi,

Thanks for your inquiry.
Yes, please refer to following code.
Code: Select all
            Presentation templatePPT = new Presentation();
            templatePPT.LoadFromFile(@"F:\Sample.pptx", FileFormat.Auto);
            //when creating a PPT instance, a slide would be added by default.
            Presentation ppt = new Presentation();
            //remove the default slide
            ppt.Slides.RemoveAt(0);
            //append the slide using template
            ppt.Slides.Append(templatePPT.Slides[0]);
            ppt.SaveToFile( "15927result.pptx",FileFormat.Pptx2010);

If this doesn't meet your requirement, please provide detailed information then we will investigate it and update you.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Dec 25, 2018 6:13 am

Hi,

Hope you are doing well.
Do you try the code I provided? Does it help you solve your issue?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Jan 08, 2019 3:35 pm

Yes, definitely.

I also tried to create MasterSlide in the following way. I just need a theme on the background.
private void MasterSLide()
{
//Presentation ppt = new Presentation();
//ppt.LoadFromFile(@"sample.pptx");

first_master = presentation.Masters[0];
presentation.Masters.AppendSlide(first_master);
second_master = presentation.Masters[1];

string pic1 = @"C:\\Users\\username\\Downloads\\bg.png";
string pic2 = @"C:\\Users\\username\\Downloads\\tc.png";
RectangleF rect = new RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height);
first_master.SlideBackground.Fill.FillType = FillFormatType.Picture;
IEmbedImage image1 = first_master.Shapes.AppendEmbedImage(ShapeType.Rectangle, pic1, rect);
first_master.SlideBackground.Fill.PictureFill.Picture.EmbedImage = image1 as IImageData;
second_master.SlideBackground.Fill.FillType = FillFormatType.Picture;
IEmbedImage image2 = second_master.Shapes.AppendEmbedImage(ShapeType.Rectangle, pic2, rect);
second_master.SlideBackground.Fill.PictureFill.Picture.EmbedImage = image2 as IImageData;
}

mohitnandkishore.kanojia@globalfoundries.com
 
Posts: 8
Joined: Mon Dec 17, 2018 9:21 pm

Wed Jan 09, 2019 7:21 am

Hi,

Thanks for sharing your code.
Just feel free to contact us if you need any help.
Have a nice day :D

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Presentation