VSTO入门 (一) 建立测试工程
来源:互联网 发布:怎么用淘宝客买东西 编辑:程序博客网 时间:2024/06/13 07:33
163博客迁移!
首先如果没有安装VSTO, 需要打开控制面板,找到VS2015之类的,更改,然后安装Office开发
安装好之后,会有Visual C# -->office/sharePoint --->Word 2013 VSTO 外接程序(这个是作用所有的主机上的word文档), (另外还有, -->Word 2013 VSTO的工作薄和模板,都会创建出一个doc的文档,VSTO只是针对该文档的,不是整个主机的)
1. 直接工程名写入,然后自动出现代码, 例如:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Word;
using System.Windows.Forms; -----注意: MessageBox.Show()函数需要添加这个,不然编译不过。
namespace FirstDocumentCustomization1
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
MessageBox.Show("你好!你打开了word!");
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
MessageBox.Show("你好!你退出了word!");
}
#region VSTO 生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
直接按F5运行就可以了。
阅读全文
0 0
- VSTO入门 (一) 建立测试工程
- VSTO之旅系列(一):VSTO入门
- Cocos2d入门 <一>建立一个新工程
- XCODE 建立测试工程
- stm32入门-建立KEIL工程
- VSTO学习笔记(一)VSTO概述
- VSTO对象操作 一
- xcode PCL 工程建立及测试
- VS2010 操作Word(一)建立工程
- VSTO
- VSTO
- VSTO
- JAVA 入门测试(一)
- 自动化测试体系如何建立?(一)
- ejb 3 开发快速入门 2 建立EJB工程
- Psoc Creator 入门——空工程的建立
- Monkey 测试一 Monkey 入门
- Android入门(一):创建Android工程
- mina框架详解
- Oracle 11g ORA-00845: MEMORY_TARGET not supported on this system 说明
- 第十四章:C++的代码重用
- lua 截取中英文字符串
- SpringMVC 框架中,@RequestParam 的简单用法
- VSTO入门 (一) 建立测试工程
- SpringMVC框架搭建详解
- 使用Notepad++来比较文件
- JAVA知识_9
- Python面试常用二十题总结
- 我是一个线程
- C#mysql数据操作
- CCF——数字排序
- [易飞]展BOM数据结构之函数版本