Skip to main content

Comments

  • 3 minutes to read

The comments feature provided by the Spreadsheet control allows you to attach notes to individual cells. Comments are particularly useful if you need to provide additional information (such as reminders, notifications, clarifications, and/or feedback) without modifying the cell content.

Comments are stored separately from cell values and displayed in floating text boxes (i.e., containers) attached to commented cells that are marked by colored triangular indicators. Normally, a comment text box is displayed when the mouse pointer enters the commented cell’s boundaries.

The Spreadsheet control provides an API for the following comment-related operations:

For end-users, the Spreadsheet control provides the following tools:

Comment Container Management

Comment container management operations include creation, destruction, and moving comments between cells.

The worksheet’s container collection provides the dedicated AddCommentContainer method that creates a ready-to-use comment container attached to the specified cell object. This method automatically assigns all necessary anchoring and brush settings.

You can delete comments like any other containers in the worksheet’s Containers collection (i.e., by calling the Containers.Clear, Containers.Delete, or Containers.Remove method).

To move an existing comment between cells, simply assign another valid cell object to the comment container’s Cell property.

Container Settings Customization

Comment containers in the Spreadsheet control are implemented by as TdxSpreadSheetCommentContainer objects. Since the TdxSpreadSheetCommentContainer class is a descendant of the TdxSpreadSheetShapeContainer, a comment container possesses all basic floating container properties, including:

Note that unlike any other floating container type provided by the Spreadsheet control, comment containers support only the square/rectangular shape type.

Cell Context Menu

An end-user can create a comment in a cell by clicking the “Insert Comment…” item in its context menu:

As a result, the Customize Object dialog is invoked with the active Text tab, allowing an end-user to type in the required text. The memo editor on the Text tab already contains the active user account name (the comment container’s Author property value):

Clipboard Operations

As with any other floating container, an end-user can perform all clipboard operations on comments. End-users can copy or cut the currently selected comment container to the clipboard and the paste it into any non-commented cell in a spreadsheet document. If the focused cell already has a comment, the paste operation raises the EdxSpreadSheetError exception:

In addition to the out-of-the-box end-user functionality, the Spreadsheet control provides the following sets of commands that you can link to client controls: