String strTemplate, strPic;
strTemplate =
"C:\\Documents and Settings\\Nicolas Dufour\\Bureau\\TUJYDKJ.pps";
strPic = "C:\\Documents and Settings\\Nicolas Dufour\\Mes documents\\Mes images\\200162757-001.jpg";
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.Visible = MsoTriState.msoTrue;
objPresSet = objApp.Presentations;
objPres = objPresSet.Open(strTemplate,
MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
objSlides = objPres.Slides;
...
...
...
//Prevent Office Assistant from displaying alert messages:
bAssistantOn = objApp.Assistant.On;
objApp.Assistant.On = false;
...
...
...
//Wait for the slide show to end.
objSSWs = objApp.SlideShowWindows;
while(objSSWs.Count>=1)
{
System.Threading.Thread.Sleep(100);
}
//Reenable Office Assisant, if it was on:
if(bAssistantOn)
{
objApp.Assistant.On = true;
objApp.Assistant.Visible = false;
}
//Close the presentation without saving changes and quit PowerPoint.
objPres.Close();
objApp.Quit();