Open office documents in AxWebBrowser control without file download dialog programmatically in vb.net

314 views Asked by At

I am trying to open office files in AxWebBrowser control and i did it programmatically in vb.net. But during opening it shows file download dialog with open,save and cancel button so how can i setup it "Open" always instead clicking on it by mouse.

1

There are 1 answers

0
Alexander Ryan Baggett On

This happening because the Microsoft Web Browser control does not handle Office documents natively. What you have to do is load it in an ActiveX control within the webpage instead.

You could do something like this :

<script language="javascript">
     function openDoc() {
        var doc = new ActiveXObject("Word.Application");
        doc.visible = true;
        doc.Documents.Open("path.docx");
    } 
    opeDoc();
</script>