当前位置:企业首页 >> 新闻中心

分享到: 更多

采用反射实现后期绑定操作EXCEL的简单代码(建议

发布时间:2010-09-07 09:27 点击量:

除了采用TblImp导入Excel object库实现Excel的调用外.
其实还可以采用反射的方法获得属性,并进行后期绑定实现
Excel的调用.下面是简单的调用EXCEL程序.
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";
        myButton.Location=new System.Drawing.Point(100,100);
        myButton.Click+=new System.EventHandler(TestBound);
        
        this.Controls.Add(myButton);
        this.Text="测试后期绑定 Excel Application";
        
    }
    
    public void TestBound(object sender,System.EventArgs ef)
    {
        Type myExcel;
        myExcel=Type.GetTypeFromProgID("Excel.Application");     
        
        object objExcel;
(责任编辑:admin)

上一篇:经典水晶报表设计—分栏


下一篇:没有了

北京php培训

php家教

案例展示图

网  址:

www.chinaitweb.com

客服热线:13391795197[可发短信注明来意]

客服热线:13717978877[可发短信注明来意]

qq:802041000