Search code examples
apache-poixlsxxssf

Excel comments using xssf eventusermodel using apache poi 3.7


Here is a link to a code that uses apache 3.7.

http://massapi.com/source/poi-3.7/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFEventBasedExcelExtractor.java.html

How can i edit this code to get the comments in excel file?


Solution

  • Comments are stored in a different stream (Document Part) to the sheet, so you'd need to navigate from the sheet to the comments (if present) and parse that

    The relation will be of type XSSFRelation.SHEET_COMMENTS

    As the comments part is normally fairly small, you should be fine to just access it using normal UserModel code. CommentsTable is the class that will give you easy access to it, pass that comments part and the relation from the sheet and work your way through the comments in turn

    If you get it working, send a patch to POI so it gets included in future!