This project has moved. For the latest updates, please go here.
/*
   create a presentation and 1 empty slide with PowerPoint
   taken from Example01.cs
*/
public void Example01Main()
{
   // start powerpoint
   PowerPoint.Application powerApplication = new PowerPoint.Application();

   // add a new presentation with one new slide
   PowerPoint.Presentation presentation =
powerApplication.Presentations.Add(MsoTriState.msoTrue); presentation.Slides.Add(1, PpSlideLayout.ppLayoutClipArtAndVerticalText); // save the document string fileExtension = GetDefaultExtension(powerApplication); string documentFile = string.Format("{0}\\Example01{1}",
Application.StartupPath,
fileExtension);

presentation.SaveAs(documentFile,
PpSaveAsFileType.ppSaveAsDefault,
MsoTriState.msoTrue); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); FinishDialog fDialog = new FinishDialog("Presentation saved.", documentFile); fDialog.ShowDialog(this); } /// <summary> /// returns the valid file extension for the instance. for example ".ppt" or ".pptx" /// </summary> /// <param name="application">the instance</param> /// <returns>the extension</returns> private static string GetDefaultExtension(PowerPoint.Application application) { double Version = Convert.ToDouble(application.Version, CultureInfo.InvariantCulture); if (Version >= 12.00) return ".pptx"; else return ".ppt"; }

Last edited Jun 13, 2012 at 12:57 PM by SebastianDotNet, version 16

Comments

No comments yet.