Excel cell comments
The following example shows how you can set Excel cell comment with location, text and visibility.
Sample also shows how to format individual characters and words within a comment text.
Comments reading/writing is supported in XLSX, XLS and ODS file formats.
Comments formatting is supported only in XLSX.

import com.gembox.spreadsheet.*;
class Program {
public static void main(String[] args) throws java.io.IOException {
// If using Professional version, put your serial key below.
SpreadsheetInfo.setLicense("FREE-LIMITED-KEY");
ExcelFile workbook = new ExcelFile();
ExcelWorksheet worksheet = workbook.addWorksheet("Comments");
worksheet.getCell(0, 0).setValue("Comment examples:");
worksheet.getCell(2, 1).getComment().setText("Empty cell.");
worksheet.getCell(4, 1).setValue(5);
worksheet.getCell(4, 1).getComment().setText("Cell with a number.");
worksheet.getCell("B7").setValue("Cell B7");
ExcelComment comment = worksheet.getCell("B7").getComment();
comment.setText("Some formatted text.\nComment is:\na) multiline,\nb) large,\nc) visible, and \nd) formatted.");
comment.setVisible(true);
comment.setTopLeftCell(new AnchorCell(worksheet.getColumn(3), worksheet.getRow(4), true));
comment.setBottomRightCell(new AnchorCell(worksheet.getColumn(5), worksheet.getRow(10), false));
// Get first 20 characters of a string.
FormattedCharacterRange characters = comment.getCharacters(0, 20);
// Apply color, italic and size to selected characters.
characters.getFont().setColor(SpreadsheetColor.fromName(ColorName.ORANGE));
characters.getFont().setItalic(true);
characters.getFont().setSize(300);
// Apply color to 'formatted' part of text.
comment.getCharacters(5, 9).getFont().setColor(SpreadsheetColor.fromName(ColorName.RED));
workbook.save("Comments.%OutputFileType%");
}
}