首页 > 代码库 > C#打开PPT并自动响应客户端

C#打开PPT并自动响应客户端

using MSCORE = Microsoft.Office.Core;
using MSPPT = Microsoft.Office.Interop.PowerPoint;

namespace word
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MSPPT.ApplicationClass pptAC;
MSPPT.Presentation pptPre;
pptAC = new MSPPT.ApplicationClass();
pptPre = pptAC.Presentations.Open(@"C:\123.pptx", MSCORE.MsoTriState.msoTrue, MSCORE.MsoTriState.msoTrue, MSCORE.MsoTriState.msoFalse);
pptAC.Activate();
pptPre.NewWindow();
pptAC.PresentationBeforeSave += new MSPPT.EApplication_PresentationBeforeSaveEventHandler(pptAC_PresentationBeforeSave);
}
private void pptAC_PresentationBeforeSave(MSPPT.Presentation pp,ref bool Cancel)
{
MessageBox.Show("hello Excel");
}
}
}

C#打开PPT并自动响应客户端