Cell comments

EasyXLS™ library allows you to export Excel files with comments on cell sheets and set comment properties such as text, comment size, font settings and foreground.

The component also allows reading comments from Excel files.

Source code sample

The below example shows how to export an Excel file with comments on cells.


The screen shot provides an example of an Excel report that has comments added on first row. The comments are signaled out by the red right-upper corner on the cell. If you point your cursor on it, the comment box will be displayed.

Read, export comment to Excel

Comment text

The comment text can be simple text as in the above code sample and set by using ExcelComment.setText method or it can be in rich text format. The RTF is attained by means of HTML syntax by using ExcelComment.setHTMLText method.

Comment font settings

EasyXLS allows you to set the font name, font size, bold and italic options, foreground, strikethrough, underline style, superscript and subscript by using methods from ExcelComment class.

For rich text formatting it is used the HTML syntax. The following tags are supported:
<font color= face= size=>
The above tags have the same meaning as in HTML.

In order to set the underline style for a group of characters EasyXLS uses four specific tags:
<underline double>
<underline single-accounting>
<underline double-accounting>

Comment width and height

The width and height of the comment can be specified in pixels using DrawingObject.setSize method that is available in ExcelComment class because of the class inheritance.

Export comment to Excel file

EasyXLS allows you to export Excel files with comments using ExcelCell.setComment method. The above code sample shows how to achieve this goal.

Read comment from Excel file

EasyXLS allows you to read comments from Excel file using ExcelCell.getComment method. The Excel file must be imported first and after that the comments of the cells are available.

Available for: Professional, Excel Writer, Excel Reader
Go to top

EasyXLS Excel libraries:

.NET Excel Library
full .NET version to import, export or convert Excel files
COM+ Excel Library
full COM+ version to import, export or convert Excel files
Java Excel Library
full Java version to import, export or convert Excel files
Download EasyXLS™ Excel Library for .NET and Java

File formats:

MS Excel 97 - 2003
MS Excel 2007 - 2019
MS Excel 2021
Office 365