没办法,自己鳖了半个月弄出点眉目来,现共享出来! using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using PowerPoint = Microsoft.Office.Interop.PowerPoint; using System.Runtime.InteropServices;namespace PPTTest { public partial class Form1 : Form { private PowerPoint.Application oPptApp; public Form1() { InitializeComponent(); } private int slipeint; private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { this.Activate(); //Get reference to Excel.Application from the ROT. oPptApp = (PowerPoint.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("PowerPoint.Application"); oPptApp.SlideShowBegin += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowBeginEventHandler(oPptApp_SlideShowBegin); oPptApp.PresentationNewSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_PresentationNewSlideEventHandler(oPptApp_PresentationNewSlide); oPptApp.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(oPptApp_SlideShowNextSlide); //oPptApp.SlideSelectionChanged += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideSelectionChangedEventHandler(oPptApp_SlideSelectionChanged); label1.Text = oPptApp.OperatingSystem; //Display the name of the object. //MessageBox.Show(oPptApp.Caption); //Release the reference. //oPptApp = null;
//// QI for IConnectionPointContainer. //UCOMIConnectionPointContainer oConnPointContainer = (UCOMIConnectionPointContainer)oPPT; //// Get the GUID of the EApplication interface. //Guid guid = typeof(PowerPoint.EApplication).GUID; //// Find the connection point. //oConnPointContainer.FindConnectionPoint(ref guid, out m_oConnectionPoint); //// Call Advise to sink up the connection. //m_oConnectionPoint.Advise(this, out m_Cookie); } //void oPptApp_SlideSelectionChanged(Microsoft.Office.Interop.PowerPoint.SlideRange SldRange) //{ // slipeint = SldRange.SlideID; //} void oPptApp_SlideShowNextSlide(Microsoft.Office.Interop.PowerPoint.SlideShowWindow Wn) { slipeint = Wn.View.CurrentShowPosition; //string temp123; //temp123 = Wn.Presentation.Slides.Count.ToString(); string temp2 = Wn.Presentation.Slides[slipeint].Shapes[1].TextFrame2.TextRange.Text; //slipeint++; MessageBox.Show(temp2);
} void oPptApp_PresentationNewSlide(Microsoft.Office.Interop.PowerPoint.Slide Sld) { //this.Activate(); label1.Text = "1"; //throw new Exception("The method or operation is not implemented."); MessageBox.Show("124124124124124124"); } void oPptApp_SlideShowBegin(Microsoft.Office.Interop.PowerPoint.SlideShowWindow Wn) { slipeint =Wn.View.CurrentShowPosition; //string temp123; //temp123 = Wn.Presentation. //MessageBox.Show(temp123+"www"); //MessageBox.Show(Wn.Presentation.Slides.s); } } }
http://support.microsoft.com/kb/303718/zh-cn
{
PowerPoint.Application objApp = new PowerPoint.Application();
PowerPoint._Presentation objPres;
objPres = objApp.Presentations.Open(strTemplate, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse); //string strurl = System.Web.HttpContext.Current.Request.Url.ToString().Replace("default.aspx", "image"); objPres.SaveAs(realurl + "WZH_Project/" + projectname + "/PPT", PowerPoint.PpSaveAsFileType.ppSaveAsJPG, MsoTriState.msoCTrue);//Server.MapPath("")+"/image" objPres.Close();
//objApp.ActiveWindow.Close();
objApp.Quit();
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using System.Runtime.InteropServices;namespace PPTTest
{
public partial class Form1 : Form
{
private PowerPoint.Application oPptApp;
public Form1()
{
InitializeComponent();
}
private int slipeint; private void Form1_Load(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
this.Activate(); //Get reference to Excel.Application from the ROT.
oPptApp = (PowerPoint.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("PowerPoint.Application");
oPptApp.SlideShowBegin += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowBeginEventHandler(oPptApp_SlideShowBegin);
oPptApp.PresentationNewSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_PresentationNewSlideEventHandler(oPptApp_PresentationNewSlide);
oPptApp.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(oPptApp_SlideShowNextSlide);
//oPptApp.SlideSelectionChanged += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideSelectionChangedEventHandler(oPptApp_SlideSelectionChanged); label1.Text = oPptApp.OperatingSystem;
//Display the name of the object.
//MessageBox.Show(oPptApp.Caption);
//Release the reference.
//oPptApp = null;
//// QI for IConnectionPointContainer.
//UCOMIConnectionPointContainer oConnPointContainer = (UCOMIConnectionPointContainer)oPPT;
//// Get the GUID of the EApplication interface.
//Guid guid = typeof(PowerPoint.EApplication).GUID; //// Find the connection point.
//oConnPointContainer.FindConnectionPoint(ref guid, out m_oConnectionPoint);
//// Call Advise to sink up the connection.
//m_oConnectionPoint.Advise(this, out m_Cookie); } //void oPptApp_SlideSelectionChanged(Microsoft.Office.Interop.PowerPoint.SlideRange SldRange)
//{
// slipeint = SldRange.SlideID;
//} void oPptApp_SlideShowNextSlide(Microsoft.Office.Interop.PowerPoint.SlideShowWindow Wn)
{
slipeint = Wn.View.CurrentShowPosition;
//string temp123;
//temp123 = Wn.Presentation.Slides.Count.ToString();
string temp2 = Wn.Presentation.Slides[slipeint].Shapes[1].TextFrame2.TextRange.Text;
//slipeint++;
MessageBox.Show(temp2);
} void oPptApp_PresentationNewSlide(Microsoft.Office.Interop.PowerPoint.Slide Sld)
{
//this.Activate();
label1.Text = "1";
//throw new Exception("The method or operation is not implemented.");
MessageBox.Show("124124124124124124");
} void oPptApp_SlideShowBegin(Microsoft.Office.Interop.PowerPoint.SlideShowWindow Wn)
{
slipeint =Wn.View.CurrentShowPosition;
//string temp123;
//temp123 = Wn.Presentation.
//MessageBox.Show(temp123+"www");
//MessageBox.Show(Wn.Presentation.Slides.s);
} }
}
具体的源码在这里!