import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.*;
workbook = WorkbookFactory.create(new FileInputStream("test1.xlsx"))
ch = workbook.getCreationHelper()
anchor = ch.createClientAnchor()
// コメントを作成
sheet = workbook.getSheetAt(0)
drawing = sheet.createDrawingPatriarch()
comment = drawing.createCellComment(anchor)
comment.setString(ch.createRichTextString("コメントです"))
comment.setAuthor("author")
sheet.getRow(0).getCell(0).setCellComment(comment)
workbook.write(new FileOutputStream("test20.xlsx"))
サンプルExcelブック(test1.xlsx)
出力Excel(text20.xlsx)
動作環境
groovy 1.7.0, JDK6 Update18, Apache POI 3.6
0 件のコメント:
コメントを投稿