Re: PowerPoint automation in Webbrowser Control
- From: "ChrisHarrington" <charrington-at-activeinterface.com>
- Date: Sun, 12 Aug 2007 02:52:45 -0400
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
.
- References:
- PowerPoint automation in Webbrowser Control
- From: sam_sam80
- PowerPoint automation in Webbrowser Control
- Prev by Date: Re: Server Side Mail Merge
- Next by Date: RE: Develop Microsoft Office solutions with Visual Studio .NET
- Previous by thread: PowerPoint automation in Webbrowser Control
- Next by thread: RE: Develop Microsoft Office solutions with Visual Studio .NET
- Index(es):
Relevant Pages
|