Shurikn Posted May 30, 2005 Posted May 30, 2005 is there any way to read powerpoint presentation from c#. I dont want powerpoint to open, i want to play the things directly from my program. Quote
pelican Posted June 1, 2005 Posted June 1, 2005 which powerpoint version are you using? if you are using office xp and above, powerpoint should not open. Quote
Shurikn Posted June 7, 2005 Author Posted June 7, 2005 I got powerPoint 2003, and it'S openning, maybe you're using something else than I do. 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(); and the program always fail on the objApp.Quit() giving that error: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in ZoneMedia.exe Additional information: Presentation (unknown member) : Object does not exist. and the powerPoint window stays open. Quote
keenlearner Posted April 29, 2009 Posted April 29, 2009 declare a PresentationClose event handler of the PowerPoint Application class before objApp.Quit(); and close the presentation in the method definition. also remove objPres.close(); you wont get this error anymore... Quote
Cindy Meister Posted May 6, 2009 Posted May 6, 2009 is there any way to read powerpoint presentation from c#. I dont want powerpoint to open, i want to play the things directly from my program. I got powerPoint 2003, and it'S openning If you don't want PowerPoint to run at all, then you'd have to read the closed file. For version 2003 (and earlier) that means the old, proprietary binary file formats. The following links are to a forum where these are discussed, and to information on obtaining the specs. - Forum - obtaining For Office 2007 you'd need to use the Office 2007 OpenXML file formats (just in case you'd need to migrate your solution in the future). Quote
Recommended Posts