开发者

any possibility to call C# function with javascript?

开发者 https://www.devze.com 2023-01-21 14:21 出处:网络
I wrote an office addin and with which there is a function : openFile(String path) and in the office addi开发者_JAVA技巧n I embed a browser object and with that I can embed a webpage on the office add

I wrote an office addin and with which there is a function : openFile(String path) and in the office addi开发者_JAVA技巧n 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 ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消