最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
采用反射实现后期绑定操作EXCEL的简单代码(建议加入精华区)
时间:2022-07-02 11:30:29 编辑:袖梨 来源:一聚教程网
除了采用TblImp导入 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;
其实还可以采用反射的方法获得属性,并进行后期绑定实现
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;
相关文章
- 七卡之境北欧阿兹特克自伤流如何搭配 09-18
- 对决剑之川楚家庄手记在哪里 09-18
- 异人之下张灵玉技能怎么使用 09-18
- 三国望神州吕布关卡如何打 09-18
- 对决剑之川西河伽罗技能流派有哪些选择 09-18
- 嘟嘟脸恶作剧巴丽叶有什么技能 09-18