я хочу открыть документ Word программно с помощью Microsoft.Interop.Word и вставить комментарий в ячейку таблицы. У меня есть начальная и конечная позиции диапазона ячейки. (Range.Start \ Range.End)
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);
}
При вставке комментария Word вылетает