views:

78

answers:

3

I wrote an office addin and with which there is a function : openFile(String path) and in the office addin I embed a browser object and with that I can embed a webpage on the office addin, and now I hope I can call the C# function "openFile" and pass in a path in the webpage with javascript, and let office open the designated file for me . Is this possible ? What can I do ?

+4  A: 

Yes it is possible.

This is done via the window.external property (and ObjectForScripting on the host side). See WebBrowser Control Overview under the FAQ.

Happy coding.

Edit: However, there is likely not a way to access the value supplied to a file upload field unless you use a BHO -- this is a secondary question/issue, if it exists.

pst
Thanks, happy coding ~~
MemoryLeak
A: 

You can call C# with JavaScript using AJAX extensions in ASP.Net. See this SO Post for how., or this blog post for more details.

Rodney Foley
Don't assume the question just by reading the title ;-)
Shoban
I did read the post and I don't see how my answer is not applicable and would not help him. It is poor taste to just down vote without being specific as to WHY it is wrong.
Rodney Foley
Its not an asp.net application. Its for an office addin
Shoban
A: 

EDIT: sorry about the imprecise link, but it would be just fine to write a comment explaining the reasons for vote down.

Pato