This project has moved and is read-only. For the latest updates, please go here.
/*
   using events in PowerPoint
   taken from Example06.cs
*/
private void Example06Main()
{
   // start powerpoint and turn off msg boxes
   PowerPoint.Application powerApplication = new PowerPoint.Application();  
   powerApplication.Visible = MsoTriState.msoTrue;

   // PowerPoint 2000 doesnt support DisplayAlerts,
// we check at runtime its available and set
if(powerApplication.EntityIsAvailable("DisplayAlerts")) powerApplication.DisplayAlerts = PpAlertLevel.ppAlertsNone; // we register some events. note: the event trigger was called from power point,
// means an other Thread
powerApplication.PresentationCloseEvent +=
new NetOffice.PowerPointApi.Application_PresentationCloseEventHandler(
powerApplication_PresentationCloseEvent); powerApplication.AfterNewPresentationEvent +=
new NetOffice.PowerPointApi.Application_AfterNewPresentationEventHandler(
powerApplication_AfterNewPresentationEvent); // add a new presentation with one new slide PowerPoint.Presentation presentation =
powerApplication.Presentations.Add(MsoTriState.msoTrue); PowerPoint.Slide slide = presentation.Slides.Add(1, PpSlideLayout.ppLayoutBlank); // close the document presentation.Close(); // close power point and dispose reference powerApplication.Quit(); powerApplication.Dispose(); } void powerApplication_PresentationCloseEvent(NetOffice.PowerPointApi.Presentation Pres) { textBoxEvents.BeginInvoke(_updateDelegate,
new object[] { "Event PresentationClose called." }); Pres.Dispose(); } void powerApplication_AfterNewPresentationEvent(NetOffice.PowerPointApi.Presentation Pres) { textBoxEvents.BeginInvoke(_updateDelegate,
new object[] { "Event AfterNewPresentation called." }); Pres.Dispose(); } private void UpdateTextbox(string message) { textBoxEvents.AppendText(message + "\r\n"); }

Last edited Jun 13, 2012 at 1:41 PM by SebastianDotNet, version 8

Comments

No comments yet.