Fight With Me!!!

导航

JXL获取excel批注

/**
 * Jxl.jar(2.6.12)
 * @author lmiky
 * @date 2011-11-26
 */
public class JxlTest {

    /**
     * 测试获取批注
     * @author lmiky
     * @date 2011-11-26
     * @param filePath
     * @throws IOException 
     * @throws BiffException 
     */
    public void getCommentTest(String filePath) throws BiffException, IOException {
        File file = new File(filePath);
        Workbook wb = Workbook.getWorkbook(file);
        Sheet[] sheets = wb.getSheets();
        Sheet sheet = sheets[0];
        Cell[] cells = sheet.getRow(0);
        Cell cell = cells[0];
        System.out.println("内容:" + cell.getContents());
        System.out.println("批注:" + cell.getCellFeatures().getComment());
    }
    
    
    public static void main(String[] args) throws BiffException, IOException {
        new JxlTest().getCommentTest("D:/测试.xls");
    }
}

 

posted on 2015-09-07 18:30  nickTimer  阅读(393)  评论(0编辑  收藏  举报