I want to read/extract the value from HSSFComment.
I can access the HSSFComment by the following code:
HSSFComment comment = workSheet.getCellComment(1, 0);
But, how can I get the text/value from that “comment” instance?
there are tow methods in HSSFComment:
getTextObjectRecord()
getNoteRecord()
But both are protected methods…that’s why I can’t access those from my class. in other word, these methods are not visible from my class. Following line of code doesn’t compile.
TextObjectRecord txo = comment.getTextObjectRecord();
Any comments?
Use
getString()inherited fromHSSFTextBox. This returns anHSSFRichTextString, which itself has agetString()method to get the plain text. In otherwordsWhich you can’t do like that due to the possibility of
nullreturns, but that’s the idea.