代码如下:
public static HSSFComment setComment(HSSFSheet sheet,String contextLog){
HSSFPatriarch patr = sheet.createDrawingPatriarch();
HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0 , 0 , 0 , 0 , ( short ) 4 , 2, ( short ) 6 , 5);
HSSFComment comment = patr.createComment(clientAnchor);
HSSFRichTextString str = new HSSFRichTextString(contextLog);
comment.setString(str);
comment.setAuthor("System check");
return comment;
}
我在循环里调用
comment = ExcelDataUtil.setComment(sheet, "不能为空,并且长度不能大于"+ rest.getLong(2));
sheet.getRow(j).createCell((short)i).setCellComment(comment);
为什么只有最后一个单元格才生效?
HSSFClientAnchor(0 , 0 , 0 , 0 , ( short ) 4 , 2, ( short ) 6 , 5)这几个参数分别是什么?
是不是注释每次都被新的都覆盖了,但我改后4位参数也是一样只有最后一个单元格看到效果。
高手们帮帮忙!!联系邮箱 [email protected]
public static HSSFComment setComment(HSSFSheet sheet,String contextLog){
HSSFPatriarch patr = sheet.createDrawingPatriarch();
HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0 , 0 , 0 , 0 , ( short ) 4 , 2, ( short ) 6 , 5);
HSSFComment comment = patr.createComment(clientAnchor);
HSSFRichTextString str = new HSSFRichTextString(contextLog);
comment.setString(str);
comment.setAuthor("System check");
return comment;
}
我在循环里调用
comment = ExcelDataUtil.setComment(sheet, "不能为空,并且长度不能大于"+ rest.getLong(2));
sheet.getRow(j).createCell((short)i).setCellComment(comment);
为什么只有最后一个单元格才生效?
HSSFClientAnchor(0 , 0 , 0 , 0 , ( short ) 4 , 2, ( short ) 6 , 5)这几个参数分别是什么?
是不是注释每次都被新的都覆盖了,但我改后4位参数也是一样只有最后一个单元格看到效果。
高手们帮帮忙!!联系邮箱 [email protected]
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货