Objectmix
Tags Register Mark Forums Read

PowerPoint automation in Webbrowser Control : CSharp

This is a discussion on PowerPoint automation in Webbrowser Control within the CSharp forums in Programming Languages category; 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 ...


Object Mix > Programming Languages > CSharp > PowerPoint automation in Webbrowser Control

Reply

 

LinkBack Thread Tools
  #1  
Old 08-09-2007, 09:43 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default PowerPoint automation in Webbrowser Control

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

  #2  
Old 08-09-2007, 10:04 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: PowerPoint automation in Webbrowser Control

What do you mean you lose control of your file?

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

<sam_sam80@hotmail.com> wrote in message
news:1186670574.094619.177140@57g2000hsv.googlegroups.com...
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


Reply

Thread Tools


Similar Threads

Thread Thread Starter Forum Replies Last Post
Automation from Access to Powerpoint usenet ADO DAO RDO RDS 1 11-22-2007 01:16 AM
gridview and powerpoint automation usenet CSharp 4 10-24-2007 10:52 AM
Using ExecWB to control font size in a WebBrowser control usenet basic.visual 2 07-01-2007 03:44 PM
PowerPoint Automation usenet DOTNET 0 11-21-2006 03:40 AM


All times are GMT -5. The time now is 01:09 AM.

Managed by Infnx Pvt Ltd.