Insert cell comments in excel

What is the best way to embed cell comments in excel 2007 files programmatically using C # and .net 3.5?

+5
source share
4 answers

I just did just that, but with MS Word (using Microsoft.Office.Interop.Word

range.Comments.Add (range, ref_categoryMessage);

So, I would suggest using Microsoft.Office.Interop.Excel and a similar method. Consider this from MSDN:

http://msdn.microsoft.com/es-es/library/microsoft.office.interop.excel.range.addcomment.aspx

Also see this

+6
source

The accepted answer points are in the right direction, but the correct syntax is:

Excel.Range cell; 
cell.AddComment("My comment");
+3

Have you tried using VSTO? You can easily download and manage an Excel document. To add a comment to a cell, upload the file, activate the worksheet, then select the cell as a range and set the comment.

0
source
Excel._Worksheet oSheet =
  (Microsoft.Office.Interop.Excel._Worksheet) excelWorkbook.ActiveSheet;
oSheet.Cells[2, 3].Cells.AddComment("Selam");
0
source

All Articles