Problemas de C # Powerpoint SlideShowEnd
-
20-08-2019 - |
Pregunta
Estoy creando una aplicación C # que reproduce una presentación de diapositivas de PowerPoint. Después de que la presentación de diapositivas haya terminado, quiero detener powerpoint y volver a mi programa nuevamente. El problema que tengo es que tengo que hacer clic al final de la presentación de diapositivas para volver a mi programa ...
¿Hay alguna forma en que pueda deshabilitar esperar un clic?
private void ShowPresentation()
{
String strPresentation, strPic;
strPresentation = Application.StartupPath + "\\testje.ppt";
bool bAssistantOn;
//PowerPoint.Application objApp;
PowerPoint.Presentations objPresSet;
PowerPoint._Presentation objPres;
PowerPoint.Slides objSlides;
PowerPoint._Slide objSlide;
PowerPoint.TextRange objTextRng;
PowerPoint.Shapes objShapes;
PowerPoint.Shape objShape;
PowerPoint.SlideShowWindows objSSWs;
PowerPoint.SlideShowTransition objSST;
PowerPoint.SlideShowSettings objSSS;
PowerPoint.SlideRange objSldRng;
Graph.Chart objChart;
//Create a new presentation based on a template.
objApp = new PowerPoint.Application();
objApp.SlideShowBegin += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowBeginEventHandler(powerpnt_SlideShowBegin);
objApp.SlideShowEnd += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(powerpnt_SlideShowEnd);
objApp.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(powerpnt_SlideShowNextSlide);
objApp.Visible = MsoTriState.msoTrue;
objPresSet = objApp.Presentations;
objPres = objPresSet.Open(strPresentation, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
objSlides = objPres.Slides;
//Prevent Office Assistant from displaying alert messages:
bAssistantOn = objApp.Assistant.On;
objApp.Assistant.On = false;
//Run the Slide show from slides 1 thru 3.
objSSS = objPres.SlideShowSettings;
objSSS.StartingSlide = 1;
objSSS.EndingSlide = objSlides.Count;
objSSS.Run();
}
private void powerpnt_SlideShowEnd(Microsoft.Office.Interop.PowerPoint.Presentation Pres)
{
objApp.Quit();
}
En pocas palabras, SlideShowEnd solo se activa cuando se reproduce la última diapositiva y he hecho clic en la presentación. Quiero que SlideShowEnd se active cuando se haya reproducido la última diapositiva ...
Solución
En la configuración de PowerPoint hay una opción: Terminar con el lado negro. puede intentar ver si esto existe en el COM y usarlo.