Example usage for org.apache.poi.xssf.usermodel XSSFSheet hasComments

List of usage examples for org.apache.poi.xssf.usermodel XSSFSheet hasComments

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFSheet hasComments.

Prototype

public boolean hasComments() 

Source Link

Document

Does this sheet have any comments on it?

Usage

From source file:org.bbreak.excella.reports.tag.ImageParamParser.java

License:Open Source License

/**
 * ????????//from   ww w .  ja v  a  2s.  co  m
 * 
 * @param sheet 
 * @return true?false
 */
private boolean hasComments(Sheet sheet) {
    if (sheet instanceof XSSFSheet) {
        XSSFSheet xssfSheet = (XSSFSheet) sheet;
        return xssfSheet.hasComments();
    } else if (sheet instanceof HSSFSheet) {
        Iterator<Row> rowIterator = sheet.iterator();
        while (rowIterator.hasNext()) {
            Row row = rowIterator.next();
            Iterator<Cell> cellIterator = row.iterator();
            while (cellIterator.hasNext()) {
                Cell cell = cellIterator.next();
                Comment comment = cell.getCellComment();
                if (comment != null) {
                    return true;
                }
            }
        }
    }
    return false;
}