我想使用 Microsoft.Interop.Word 以编程方式打开一个 Word 文档,并将注释插入到表格单元格中。我有单元格范围的开始和结束位置。(范围.开始\范围.结束)
Application.ActiveDocument.Select(); // select ative document
Range rg = Application.Selection.Range; // get the range of the current selection (all document)
if (rg.Tables.Count > 0)
{
Microsoft.Office.Interop.Word.Range rngTab = rg;
//set the coordinate of the Range of the text
rngTab.Start = startRng;
rngTab.End = endRng;
doc.ActiveWindow.Visible = true;
rg.Select();
Application.ActiveDocument.Comments.Add(rngTab, ref commentText);
}
当插入评论字崩溃