I am currently hosting an IE Browser control in a .NET (2.0) Form and using it to load Office files such as Excel and Word thusly:
_ieCtrl.Navigate("C:\\test.xls", False);
The hosting and loading works well except whenever I navigate to a file I am presented with a dialog that asks whether I want to save or open the file. (This is standard IE file-download behavior.) I always want to open it of course and I do not want the dialog to show.
Another issue is that when I close the window that hosts the IE control and the Office doc the document does not close and remains open on disk. This means that subsequent attempts to open the same file via my app or the native office app will fail because of the sharing violation.
Is there a programmatic way of avoiding this dialog and cleaning up resources afterward? I am asking for a programmatic answer because web research has only yielded solutions that entail modifying OS-level settings.
Bounty NOTE:
I am open to any solution to this issue that will allow me to:
- Host an Excel spreadsheet inside my application
- Work rather transparently (avoid usability issues like the one described above)
- Avoid having to make any OS-specific changes that may affect other applications (especially icluding IE)
- Is zero additional cost (no licensed 3rd party libs please) Code Project and other open source resources are OK
- Not mess around with the DSO Framer ActiveX control, unless a stable version is developed/discovered