/*
   create ole chart object with PowerPoint
   taken from Example05.cs
*/
private void Example05Main()
{
   // start powerpoint 
   PowerPoint.Application powerApplication = new PowerPoint.Application();

   // add a new presentation with one new slide
   PowerPoint.Presentation presentation = powerApplication.Presentations.Add(
MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // add a chart slide.Shapes.AddOLEObject(120, 111, 480, 320, "MSGraph.Chart", "",
MsoTriState.msoFalse, "", 0, "", MsoTriState.msoFalse); // save the document string fileExtension = GetDefaultExtension(powerApplication); string documentFile = string.Format("{0}\\Example05{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:34 PM by SebastianDotNet, version 5

Comments

p4pranavam Feb 26, 2014 at 11:21 AM 
Which is the Data File for this chart????