使用VSTO向Word文档中添加数学公式
这是个极其简单的实例,用来向Word文档中添加一个数学汇总公式。
[csharp]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Word = Microsoft.Office.Interop.Word;
using System.Diagnostics;
namespace VSTOInsertEquations
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Word.Application wdApplication = null;
Process[] pl = Process.GetProcessesByName("WINWORD.exe");
if (pl.Length > 0)
{
wdApplication = (Word.Application)System.Runtime.InteropServices
.Marshal.GetActiveObject("Word.Application");
}
else
{
wdApplication = new Word.Application();
}
if (wdApplication != null)
{
Word.Document newDocument = wdApplication.Documents.Add();
//一下代码添加了汇总公式
Word.Range wdFunctionR = wdApplication.Selection.OMaths
.Add(wdApplication.Selection.Range);
相关新闻>>
- 发表评论
-
- 最新评论 进入详细评论页>>
今日头条
更多>>您可能感兴趣的文章
- C#高级编程:使用XPath命名空间中的类[2]
- 让asp.net mvc的Action支持jQuery直接提交的javascript对
- Add View -> Strongly-typed view ->Model Class
- .NET类库中发现设计模式:策略模式
- DCOM--高效率主从服务器程序的新概念
- .Net插件框架的实现及分析(二)
- Asp.net MVC源码分析--UrlRoutingModule与Service location的
- 使用HttpWebRequest下载经过重定向的文件
- .NET简谈设计模式之(装饰者模式性能问题?)
- ASP.ENT前台更改绑定数据的日期格式



