|
//Opens an existing Presentation from file system.
IPresentation pptxDoc = Presentation.Open(@"Trial.pptx");
//Retrieves the first slide from Presentation
ISlide slide = pptxDoc.Slides[0];
//Retrieves the shape to format the section1.
IShape shape = slide.Shapes[5] as IShape;
if(shape.TextBody.Paragraphs.Count!=0)
{
//Retrieves the first paragraph of the shape.
IParagraph paragraph = shape.TextBody.Paragraphs[0];
ChangeFont(paragraph,"Arial",25f);
}
//Retrieves the shape to format the section2.
shape = slide.Shapes[1] as IShape;
if (shape.TextBody.Paragraphs.Count != 0)
{
//Retrieves the first paragraph of the shape.
IParagraph paragraph = shape.TextBody.Paragraphs[0];
ChangeFont(paragraph, "Times New Roman", 36f);
}
//Saves the presentation to the file system.
pptxDoc.Save("Result.pptx");
//Closes the Presentation.
pptxDoc.Close(); |