How to EMBED Excel in Form

Source: Internet
Author: User

Neither. NET Framework1.0 nor 1.1 implements the OleContainer component. Check MSDN and get a prompt: You can use IEBrowser to simulate OleContainer. This is definitely an overweight implementation. However, it is the most time-consuming method. This article briefly describes how to use the IEBrowser control to embed an Excel table.
1. First, import "Microsoft WEB Browser" in the toolbar ". You can right-click the toolbar and select "Add/Remove items ". Select "COM component" in the Custom toolbox that appears, find "Microsoft Web Browser" in the component, select and confirm. See:
2. Create a Form, select the "Microsoft Web Browser" component in the toolbar, and place it in the Form.
3. Use the following code to import an Excel file:
AxWebBrowser1.Navigate (@ "c: estest.xls ");
4. Add the DocumentComplete event of axwebbrowser1. And obtain the Excel Ole object in the event:
Public Excel. Workbook wb;
Private void axWebBrowser1_DocumentComplete (object sender, AxSHDocVw. DWebBrowserEvents2_DocumentCompleteEvent e)
{
Wb = (Excel. Workbook) axWebBrowser1.Document;
}
5. Using wb, you can directly access the Excel table.
Although it is easy to use the IE control, it is not a good method. Currently, only third-party controls are available, or. NET 2.0 is expected. If you have a better method, share it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.