gpt4 book ai didi

java - Apache poi excel 注释换行文本

转载 作者:行者123 更新时间:2023-12-02 05:10:48 37 4
gpt4 key购买 nike

如何确保评论栏足够大以显示评论?我搜索了一些属性,例如换行文本,但没有成功。

if(drawingPatriarch == null)
{
drawingPatriarch = sh.createDrawingPatriarch();
}

HSSFClientAnchor anchor = new HSSFClientAnchor();

anchor.setCol1(cell.getColumnIndex());
anchor.setCol2(cell.getColumnIndex()+1);
anchor.setRow1(row.getRowNum());
anchor.setRow2(row.getRowNum()+3);

Comment cellComment = drawingPatriarch.createCellComment(anchor);
cellComment.setString(new HSSFRichTextString(comment));
if(author != null)
cellComment.setAuthor(author);

cell.setCellComment(cellComment);

最佳答案

http://poi.apache.org/spreadsheet/quick-guide.html

CellStyle wrapText=workbookWrite.createCellStyle();
wrapText.setWrapText(true);
cellComment.setCellStyle(wrapText);

关于java - Apache poi excel 注释换行文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27354384/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com