在程序里新建了一个Word文档,但是该word窗口不是当前窗口,怎么设置才能使其成为当前打开窗口?
我的新建Word代码如下:
private void button3_Click(object sender, EventArgs e)
{
object missing = System.Reflection.Missing.Value;
object fileName = "normal.doc"; // template file name
object newTemplate = false;
object docType = 0;
object isVisible = true;
Word.Document aDoc = WordApp.Documents.Add(ref fileName, ref newTemplate, ref docType,
ref isVisible);
WordApp.Visible = true;
aDoc.Activate();
WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
WordApp.Selection.Font.Bold = (int)Word.WdConstants.wdToggle;
}