这似乎有效。。。你的问题中有没有特别要求?
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;
namespace WordAddIn1
{
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
var app = Application;
var doc = app.Documents.Add(Visible: false);
doc.Close();
var docCount = Application.Documents.Count ;
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region Von VSTO generierter Code
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}