Noth .NET Framework1.0 and 1.1 do not implement OlectAiner components. Turning all MSDN, I finally got a prompt: IEBROWSER can be used to simulate OleContainer. This is definitely an overweight implementation, but the most current situation is the most cost-effective approach. This article briefly explains how to use the IEBROWSER control to embed an Excel form.
1. First, you need to import the Microsoft Web Browser in the toolbar. You can right click on the toolbar to select Add / Transfer. Then select "COM components" in the custom toolbox that appears, and finally find the "Microsoft Web Browser" in the component, check and determine. See below:
2. Create an Form, select the Microsoft Web Browser component in the toolbar, put it in the Form.
3. Use the following code to import an Excel form: AXWebBrowser1.naviGate (@ "c: /test/test.xls);
4. Join the DocumentComplete event of AxWebBrowser1. Excel and acquires the object in the event Ole: public Excel.Workbook wb; private void axWebBrowser1_DocumentComplete (object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e) {wb = (Excel.Workbook) axWebBrowser1.Document;}
5. With WB, you can directly access the Excel form.
Although it is very simple to use IE control, it is not a good way. There are currently only third-party controls, or look forward to .NET 2.0. If you have a better way, you may wish to share it.