Here is the code to create Powerpoint Slide show
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using PowerPoint;
using Graph;
using Microsoft.Office.Core;
private static PowerPoint.Presentation _pPres = null;
private static PowerPoint.ApplicationClass _pApp = null;
private int noofSalespersons;
protected void Page_Load(object sender, EventArgs e)
{
_pApp = new ApplicationClass();
//Graph.Chart objChart;
int noofSlides;
noofSalespersons =12;
string sTemplateFile = Server.MapPath("Resource\\Template.ppt");
_pPres = _pApp.Presentations.Open(sTemplateFile, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
noofSlides = (noofSalespersons / 10) + 1;
if (noofSalespersons%10>0)
{
noofSlides += 1;
}
int slideIndex=1;
while (_pPres.Slides.Count!=noofSlides)
{
_pPres.Slides.InsertFromFile("D:\\Template.ppt", slideIndex, 1, 1);
slideIndex += 1;
}
Chart chart;
Graph.DataSheet dataSheet;
for (int i = 1; i <= slideIndex; i++)
{
PowerPoint.Slide slide = _pPres.Slides._Index(i) as Slide;
if (i==1)
{
PowerPoint.Shape shape = slide.Shapes[1];
chart = shape.OLEFormat.Object as Graph.Chart;
dataSheet = chart.Application.DataSheet;
dataSheet.Cells[2, 2] = "50";
dataSheet.Cells[2, 3] = "40";
dataSheet.Cells[2, 4] = "50";
dataSheet.Cells[2, 5] = "50";
dataSheet.Cells[3, 2] = "60";
dataSheet.Cells[3, 3] = "70";
dataSheet.Cells[3, 4] = "80";
dataSheet.Cells[3, 5] = "60";
//dataSheet.Cells[3, 6] = "0";
dataSheet.Cells[4, 2] = "50";
dataSheet.Cells[4, 3] = "40";
dataSheet.Cells[4, 4] = "50";
dataSheet.Cells[4, 5] = "50";
//dataSheet.Cells[4, 6] = "0";
chart.Application.Update();
dataSheet = null;
chart = null;
}
ArrayList listShapeName = new ArrayList();
ArrayList listAutoShapes = new ArrayList();
ArrayList listTextBox = new ArrayList();
ArrayList listPlaceHolder = new ArrayList();
int reminingShapes;
reminingShapes = noofSalespersons % 10;
if (i>=2)
{
if ((i == slideIndex) && (reminingShapes>0))
{
int remingCount = 0;
for (int k = 1; k <= slide.Shapes.Count; k++)
{
PowerPoint.Shape shape = slide.Shapes[k];
//string shapeName = shape.Name;
//listShapeName.Add(shapeName);
if (shape.Type == MsoShapeType.msoEmbeddedOLEObject)
{
remingCount += 1;
if (remingCount>reminingShapes)
{
//slide.Shapes[k].Delete();
listShapeName.Add(k);
}
}
}
for (int m = listShapeName.Count - 1; m >= 0; m--)
{
slide.Shapes[listShapeName[m]].Delete();
}
listShapeName.Clear();
for (int k = 1; k <= slide.Shapes.Count; k++)
{
PowerPoint.Shape shape = slide.Shapes[k];
if (reminingShapes < 6)
{
if (shape.Type == MsoShapeType.msoTextBox)
{
listTextBox.Add(k);
}
}
}
if (listTextBox.Count>0)
{
for (int m = listTextBox.Count - 1; m >= listTextBox.Count - 4; m--)
{
slide.Shapes[listTextBox[m]].Delete();
}
listTextBox.Clear();
}
for (int k = 1; k <= slide.Shapes.Count; k++)
{
PowerPoint.Shape shape = slide.Shapes[k];
if (reminingShapes < 6)
{
if (shape.Type == MsoShapeType.msoAutoShape)
{
listAutoShapes.Add(k);
}
}
}
if (listAutoShapes.Count>0)
{
for (int m = listAutoShapes.Count - 1; m >= listAutoShapes.Count - 4; m--)
{
slide.Shapes[listAutoShapes[m]].Delete();
}
listAutoShapes.Clear();
}
}
int z = 0;
int bottom = 0;
for (int k = 1; k <= slide.Shapes.Count; k++)
{
PowerPoint.Shape shape = slide.Shapes[k];
string shapeName= shape.Name;
if (shape.Type==MsoShapeType.msoEmbeddedOLEObject)
{
listShapeName.Add(shapeName);
chart =shape.OLEFormat.Object as Graph.Chart;
dataSheet = chart.Application.DataSheet;
//if (k % 2 == 0)
//{
z = z + 1;
//shape.Top = newHeight;
//shape.IncrementTop(200);//(200-shape.Height) + shape.Top);
shape.Height = ((42 - (2 * z)) * 200) / (40);
//shape.Width = 90;
dataSheet.Cells[2, 2] = (((11-z) * 100) / 100).ToString();
dataSheet.Cells[3, 2] = (((11-z) * 100) / 100).ToString();
dataSheet.Cells[4, 2] = (((11-z) * 100) / 100).ToString();
dataSheet.Cells[5, 2] = (((11-z) * 100) / 100).ToString();
//shape.Width = 90;
//}
//else
//{
// //shape.Width = 86;
// shape.Height = 200;
// //newHeight = shape.Top;
// dataSheet.Cells[2, 2] = ((80 * 100) / 260).ToString();
// dataSheet.Cells[3, 2] = ((70 * 100) / 260).ToString();
// dataSheet.Cells[4, 2] = ((60 * 100) / 260).ToString();
// dataSheet.Cells[5, 2] = ((50 * 100) / 260).ToString();
//}
chart.Application.Update();
dataSheet = null;
chart = null;
}
}
}
_pPres.SaveAs("d:\\Vijay\\Powerpoint\\Sample2.ppt", PpSaveAsFileType.ppSaveAsPresentation, Microsoft.Office.Core.MsoTriState.msoFalse);
_pPres.Close();
_pApp.Quit();
GC.Collect();
}
See the original article at :: http://www.dotnetspider.com/forum/157867-Create-power-point-slide-charts-using-c-net.aspx
Hope this helps.