.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh

Home >> Code Snippets >> Threading >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

simple Animation in Powerpoint using thread(c# code)

Posted By:Sreeraj Nair Mungath       Posted Date: July 17, 2012    Points: 40    Category: Threading    URL: http://www.dotnetspark.com  

simple Animation in Powerpoint using thread(c# code)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Graph;

namespace chart
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)

            PowerPoint.Application ppApp;
            PowerPoint.Presentation ppMP;


            ppApp = new PowerPoint.Application();
            Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
            Microsoft.Office.Core.MsoTriState otrue = Microsoft.Office.Core.MsoTriState.msoTrue;
            ppApp.Visible = otrue;

            ppMP = ppApp.Presentations.Open(@"C:\Users\snair02\Desktop\test.pptx", ofalse, ofalse, otrue);

            PowerPoint.Slides slide = ppMP.Slides;

            PowerPoint.Shape shape = slide[1].Shapes["Chart"];
            Microsoft.Office.Interop.Graph.DataSheet dataSheet;
            Chart chart;

            chart = shape.OLEFormat.Object as Microsoft.Office.Interop.Graph.Chart;
            Microsoft.Office.Interop.Graph.Series serie = (Microsoft.Office.Interop.Graph.Series)chart.SeriesCollection(1);

            dataSheet = chart.Application.DataSheet;

            dataSheet.Cells[2, 2] = "10";
            Microsoft.Office.Interop.Graph.Point point = (Microsoft.Office.Interop.Graph.Point)serie.Points(1);
            point.Interior.Color = 0x808080;

            dataSheet.Cells[2, 3] = "100";
            point = (Microsoft.Office.Interop.Graph.Point)serie.Points(2);
            point.Interior.Color = 0x0000FF;

            dataSheet.Cells[2, 4] = "200";
            point = (Microsoft.Office.Interop.Graph.Point)serie.Points(3);
            point.Interior.Color = 0x00FFFF;

          dataSheet.Cells[2, 5] = "300";
          point = (Microsoft.Office.Interop.Graph.Point)serie.Points(4);
          point.Interior.Color = 0x800080;

          serie = (Microsoft.Office.Interop.Graph.Series)chart.SeriesCollection(2);

          dataSheet.Cells[3, 2] = "300";
          point = (Microsoft.Office.Interop.Graph.Point)serie.Points(1);
          point.Interior.Color = 0xFF0000;




Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend