Create a PowerPoint 2007 presentation from a template

I need to create a PowerPoint 2007 presentation from a template with the Open XML Format SDK 2.0 . The customer must provide a template and be used for an individual layout style (font, background color or image, ...). It should contain two predefined slides:

  • Text slide
  • Slide image

Now the application should create a copy of the template file, create several copies of the text and image slides and replace the content placeholders with some content.

I already found some code snippets from Microsoft to edit the title of the slide, delete them or replace the image on the slide. But I did not learn how to create a copy of an existing slide. Maybe someone can help me with this.

+4
source share
3 answers

I searched for a similar answer and found some resources for sharing:

http://msdn.microsoft.com/en-us/library/cc850834(office.14).aspx

or more samples

http://msdn.microsoft.com/en-us/library/cc850828(office.14).aspx

or on this website

http://www.openxmldeveloper.com

There is also a free book documenting the OpenXML standard , which was somewhat useful.

+1
source

This is an example of what I'm looking for, but if not, let me know: http://openxmldeveloper.org/articles/7429.aspx p>

0
source

For C #

File.Copy(SourceFile,ExportedFile); 

Basically you save the original file.

Now you open ExportedFile

 PowerPoint.Application ppApp = new PowerPoint.Application(); PowerPoint.Presentation presentation; presentation = ppApp.Presentations.Open(ExportedFile, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue); 

Now drag all the slides / shapes

 foreach (PowerPoint.Slide slide in presentation.Slides) { slide.Select(); foreach (PowerPoint.Shape shape in slide.Shapes) { if (shape.Type.ToString().Equals("<any type of shape>")) { if (shape.TextFrame.TextRange.Text.Equals("<contains a name")) { shape.TextFrame.TextRange.Text = <new value>; shape.Delete(); // or delete shape.AddPicture(<your new picture>, MsoTriState.msoTrue, MsoTriState.msoTrue, left, top, width, height); } } } 

}

Hope this can clarify your request.

0
source

All Articles