poi comment

原创
2018/08/26 23:16
阅读数 278
public static void main(String[] args) {

        try (FileOutputStream out = new FileOutputStream("/Users/chanming/work_note/abc.xls")) {
            HSSFWorkbook wb   = new HSSFWorkbook();
            HSSFSheet sheet   = wb.createSheet("Comment Sheet");
            HSSFPatriarch hpt = sheet.createDrawingPatriarch();
            HSSFCell cell1 = sheet.createRow(3).createCell(1);
            cell1.setCellValue("Excel Comment Example");
            // Setting size and position of the comment in worksheet
            HSSFComment comment1 = hpt.createComment(new HSSFClientAnchor(0, 0, 0, 0, (short) 4, 2, (short) 6, 5));
            // Setting comment text
            comment1.setString(new HSSFRichTextString("hell boy s and girls liyuhang 少年中国"));
            // Associating comment to the cell
            cell1.setCellComment(comment1);
            wb.write(out);
            out.flush();
            out.close();
        }catch(Exception e) {
            System.out.println(e.getMessage());
        }
    }
展开阅读全文
POI
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
在线直播报名
返回顶部
顶部