java 导出 excel 添加批注的方案
在 java 程序中导出 excel 文件时,有时需要添加批注来提供额外的信息。以下是实现此需求的几种方案:
普通批注
workbook wb = new workbook(); iworksheet worksheet = wb.getactivesheet(); icomment commentc3 = worksheet.getrange("c3").addcomment("c3的注释"); icomment commentc4 = worksheet.getrange("c4").addcomment("c4的注释"); icomment commentc5 = worksheet.getrange("c5").addcomment("c5的注释"); wb.save("output/memo.xlsx");
带线程的批注
Workbook wb = new Workbook(); IWorksheet sheet = wb.getActiveSheet(); ICommentThreaded ct = sheet.getRange("C3").addCommentThreaded("批注1", "韩梅梅"); ct.addReply("回复1", "李雷"); wb.save("output/comment.xlsx");