Simple code for later binding to EXCEL Using Reflection (recommended to join the essence Area)

Source: Internet
Author: User

In addition to using TblImp to import an Excel object Library.
In fact, you can also use the reflection method to obtain attributes and bind them later.
Excel call. The following is a simple call to the EXCEL program.
Using System;
Using System. Reflection;
Using System. Windows;
Using System. Windows. Forms;
Class TestLateBound: System. Windows. Forms. Form
{
Private Button myButton;
Public TestLateBound ()
{
MyButton = new Button ();
MyButton. Text = "EXCEL call ";
MyButton. Location = new System. Drawing. Point (100,100 );
MyButton. Click + = new System. EventHandler (TestBound );

This. Controls. Add (myButton );
This. Text = "binding Excel Application later in the test ";

}

Public void TestBound (object sender, System. EventArgs ef)
{
Type myExcel;
MyExcel = Type. GetTypeFromProgID ("Excel. Application ");

Object objExcel;

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.