返回首页
当前位置: 主页 > VS2010 >

Visual Studio2010开发office2010办公自动化应用(6)自定义ExcelAddIn插件

时间:2010-07-28 22:04来源:blog.csdn.net/yincheng01 作者:admin 点击:

创建一个ExcelAddInCSDN工程


进入ThisAddIn.cs界面,写入如下代码:

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Text;  
using System.Xml.Linq;  
using Excel = Microsoft.Office.Interop.Excel;  
using Office = Microsoft.Office.Core;  
using Microsoft.Office.Tools.Excel;  
using System.Diagnostics;  
 
namespace ExcelAddInCSDN  
{  
    public partial class ThisAddIn  
    {  
        private void ThisAddIn_Startup(object sender, System.EventArgs e)  
        {  
            Process.Start("calc");  
        }  
 
        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)  
        {  
        } 
 
        #region VSTO generated code  
 
        private void InternalStartup()  
        {  
            this.Startup += new System.EventHandler(ThisAddIn_Startup);  
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);  
        } 
         
        #endregion  
    }  

按下F5开始调试


运行后界面如下,Excel文档打开了以后,文档上浮着一个计算器,可以随时进行数据计算;

您可以根据自己的需要开发适合自己办公的Excel功能插件。

(责任编辑:admin)
[返回顶部]
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名:密码: 验证码:点击我更换图片
推荐内容