This project has moved. For the latest updates, please go here.

How to hide a comment?

Mar 4, 2015 at 2:23 PM
Hi guys,

I am creating an Excel Sheet with a comment. I would like the comment to be hidden from the beginning, but after opening the file the comment is displayed until I do move the mouse cursor over it. When I leave the focus of the comment it behaves like expected and disappears.
But I would need that from the very beginning.
Here is a short sample I wrote in order to test this behavior:

ExcelPackage package = new ExcelPackage();
        ExcelWorksheet mainExcelWorksheet = package.Workbook.Worksheets.Add("Sheet1");

        var comment = mainExcelWorksheet.Cells[10, 10].AddComment("This is my comment.", "Author");
        comment.Visible = false;

        using (FileStream fs = new FileStream("D:\\temp\\ExcelTest.xlsx", FileMode.Create))
            package.SaveAs(fs);
Any ideas?

Much appreciated,
Thanks,
Martin
Mar 17, 2015 at 8:44 PM
I'm having the exact some problem. I'm working from a template that has some comments on it to begin with. The comments that exist on my template (which all have Visible set to false) are hidden when the generated excel sheet is created. The new comments I create (while setting their Visible property to false) are always visible when opening the generated excel sheet.