By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

Open Excel WebBrowser

P: n/a
Joe
Hi
Anyone using the WebBrowser with Excel in DotNet 2005???

I have it working with the code below from MS but am trying to eliminate the
following behaviors

1)Stop FileDownload Dialog from Opening
2)Stop Open XML Dialog from Opening
3)Stop a separate Instance of Excel from starting

Thanks

this.axWebBrowser1.NavigateComplete2 += new
AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Even tHandler(this.axWebBrowser1_NavigateComplete2);

private void button1_Click(object sender, System.EventArgs e)

{

String strFileName;

//Find the Office document.

openFileDialog1.FileName = "";

openFileDialog1.ShowDialog();

strFileName = openFileDialog1.FileName;

//If the user does not cancel, open the document.

if (strFileName.Length != 0)

{

Object refmissing = System.Reflection.Missing.Value;

oDocument = null;

axWebBrowser1.Navigate(strFileName, ref refmissing, ref refmissing, ref
refmissing, ref refmissing);

}

}

public void axWebBrowser1_NavigateComplete2(object sender,
AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Even t e)

{

Object o = e.pDisp;

oDocument = o.GetType().InvokeMember("Document", BindingFlags.GetProperty,
null, o, null);

Object oApplication = o.GetType().InvokeMember("Application",
BindingFlags.GetProperty, null, oDocument, null);

Object oName = o.GetType().InvokeMember("Name", BindingFlags.GetProperty,
null, oApplication, null);

MessageBox.Show("File opened by: " + oName.ToString());


}
Sep 29 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.