/// <summary> /// 向单元格写入数据,对当前WorkSheet操作 /// </summary> /// <param name="rowIndex">行索引</param> /// <param name="columnIndex">列索引</param> /// <param name="text">要写入的文本值</param> public void SetCellComment(int rowIndex, int columnIndex, string comment) { try { Microsoft.Office.Interop.Excel.Range range = workSheet.Cells[rowIndex, columnIndex] as Microsoft.Office.Interop.Excel.Range; range.AddComment(comment); } catch { this.KillExcelProcess(false); throw new Exception("向单元格[" + rowIndex + "," + columnIndex + "]写数据出错!"); } }