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

时间:2014-12-11 15:37:11   收藏:0   阅读:345

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");
}
}
}

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!