Spreadsheetgear - edit comment

765 Views Asked by At

In Spreadsheetgear, I can right-click on a cell and select "edit comment". I'd like to do the same from code. But I see only an "IRange.AddComment" method, no "EditComment"... Is it possible?

1

There are 1 best solutions below

0
On BEST ANSWER

Editing a cell comment in the manner you are speaking of is purely a UI-related task (presumably from one of the WorkbookView controls) and so you won't see any "EditComment" sort of API in SpreadsheetGear's "core" API such as the IRange interface.

Instead, you would need to call BeginEdit() method on the WorkbookView while the desired comment shape is selected. Below is some sample code that demonstrates this:

// Assuming there's a comment in A1...
SpreadsheetGear.IComment comment = workbookView.ActiveWorksheet.Cells["A1"].Comment;

// Ensure the comment is visible.
comment.Visible = true;

// Select it.
comment.Shape.Select(true);

// Tell the WorkbookView to enable "edit mode" on the currently selected
// item, which in this case we know is the cell comment in A1.
workbookView.BeginEdit();