Re: PowerPoint automation in Webbrowser Control

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



welcome to the fun world of powerpoint programming.

Kill the powerpoint process when you are done - so that you make sure it is
gone

<sam_sam80@xxxxxxxxxxx> wrote in message
news:1186670772.663695.179070@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I did PowerPoint automation winthin Webbrowser Control. I can
open .ppt file and browse the slides.
My problem is when I have an other session of PPT open outside the
Webbrowser control I losse the control of my own file. Sometimes
when powerpnt process is still in the memory (caused by error in
closing PowerPoint) but not PowerPont is visible, I have the same
problem.


Here, a source code I use to do this.

//opning PPT file
object messing = System.Reflection.Missing.Value;
string filepath = "....."
this.axWebBrowser1.Navigate(filepath, ref messing, ref messing, ref
messing, ref messing);

// Get the powerpoint object
private void axWebBrowser1_DocumentComplete(object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
opDisp = e.pDisp;
oDocument =
opDisp.GetType().InvokeMember("Document",BindingFlags.GetProperty,null,opDi­
sp,null);
oApplication =
opDisp.GetType().InvokeMember("Application",BindingFlags.GetProperty,null,o­
Document,null);

// I can't do automation from this object oApplication

Object oPresentation =
opDisp.GetType().InvokeMember("ActivePresentation",BindingFlags.GetProperty­,
null, oApplication, null);
Object oSlides =
opDisp.GetType().InvokeMember("Slides",BindingFlags.GetProperty, null,
oPresentation, null);
int slideCount = (int)
(opDisp.GetType().InvokeMember("Count",BindingFlags.GetProperty,
null,
oSlides, null));
Object oSlideShowWindow =
opDisp.GetType().InvokeMember("SlideShowWindow",BindingFlags.GetProperty,
null, oPresentation, null);
Object oSSWView =
opDisp.GetType().InvokeMember("View",BindingFlags.GetProperty, null,
oSlideShowWindow, null);


// PowerPoint Application object
PowerPoint.Application pptApplication =
(PowerPoint.Application)oApplication;

// Add Event handlers
pptApplication.SlideShowNextBuild +=new
PowerPoint.EApplication_SlideShowNextBuildEventHandler(pptApplication_Slide­
ShowNextBuild);
pptApplication.SlideShowNextSlide +=new
PowerPoint.EApplication_SlideShowNextSlideEventHandler(pptApplication_Slide­
ShowNextSlide);
pptApplication.SlideShowNextClick +=new
PowerPoint.EApplication_SlideShowNextClickEventHandler(pptApplication_Slide­
ShowNextClick);
}

Any help is very appreciate
Samir


.



Relevant Pages

  • Re: PowerPoint automation in Webbrowser Control
    ... I did PowerPoint automation winthin Webbrowser Control. ... open .ppt file and browse the slides. ... this.axWebBrowser1.Navigate(filepath, ref messing, ref messing, ref ...
    (microsoft.public.dotnet.languages.csharp)
  • PowerPoint automation in Webbrowser Control
    ... I did PowerPoint automation winthin Webbrowser Control. ... open .ppt file and browse the slides. ... this.axWebBrowser1.Navigate(filepath, ref messing, ref messing, ref ...
    (microsoft.public.office.developer.automation)
  • PowerPoint automation in Webbrowser Control
    ... I did PowerPoint automation winthin Webbrowser Control. ... open .ppt file and browse the slides. ... this.axWebBrowser1.Navigate(filepath, ref messing, ref messing, ref ...
    (microsoft.public.dotnet.languages.csharp)
  • Office 11.3 Update: Does it Fix PowerPoint Linking Problem?
    ... Does it fix the problem with ... PowerPoint 2004 11.2.5+ messing up hyperlinks (as outlined in ...
    (microsoft.public.mac.office.powerpoint)