本文整理了Java中org.apache.poi.ss.usermodel.Cell.getCellComment()
方法的一些代码示例,展示了Cell.getCellComment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cell.getCellComment()
方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.Cell
类名称:Cell
方法名:getCellComment
[英]Returns comment associated with this cell
[中]返回与此单元格关联的注释
代码示例来源:origin: org.apache.poi/poi-ooxml
Comment comment = cell.getCellComment();
if(includeCellComments && comment != null) {
代码示例来源:origin: tobyweston/simple-excel
private static void copyCellComment(Cell oldCell, Cell newCell) {
if (newCell.getCellComment() != null)
newCell.setCellComment(oldCell.getCellComment());
}
代码示例来源:origin: openl-tablets/openl-tablets
@Override
public ICellComment getComment(int row, int column) {
return new XlsCellComment(getCell(row, column).getCellComment());
}
代码示例来源:origin: openl-tablets/openl-tablets
public ICellComment getComment() {
Cell cell = getCell();
if (cell != null) {
Comment comment = cell.getCellComment();
if (comment != null) {
return new XlsCellComment(comment);
} else if (region != null && !isCurrentCellATopLeftCellInRegion()) {
ICell topLeftCell = getTopLeftCellFromRegion();
return topLeftCell.getComment();
}
}
return null;
}
代码示例来源:origin: cn.afterturn/easypoi-base
private static void cloneCell(Cell cNew, Cell cOld) {
cNew.setCellComment(cOld.getCellComment());
cNew.setCellStyle(cOld.getCellStyle());
代码示例来源:origin: hyberbin/J-Excel
public static void copyCell(Cell srcCell, Cell distCell){
distCell.setCellStyle(srcCell.getCellStyle());
if(srcCell.getCellComment() != null) {
distCell.setCellComment(srcCell.getCellComment());
}
int srcCellType = srcCell.getCellType();
distCell.setCellType(srcCellType);
if (srcCellType == Cell.CELL_TYPE_NUMERIC) {
if (DateUtil.isCellDateFormatted(srcCell)) {
distCell.setCellValue(srcCell.getDateCellValue());
} else {
distCell.setCellValue(srcCell.getNumericCellValue());
}
} else if (srcCellType == Cell.CELL_TYPE_STRING) {
distCell.setCellValue(srcCell.getRichStringCellValue());
} else if (srcCellType == Cell.CELL_TYPE_BLANK) {
//nothing
} else if (srcCellType == Cell.CELL_TYPE_BOOLEAN) {
distCell.setCellValue(srcCell.getBooleanCellValue());
} else if (srcCellType == Cell.CELL_TYPE_ERROR) {
distCell.setCellErrorValue(srcCell.getErrorCellValue());
} else if (srcCellType == Cell.CELL_TYPE_FORMULA) {
distCell.setCellFormula(srcCell.getCellFormula());
} else {
//nothing
}
}
代码示例来源:origin: org.jeecg/easypoi-base
private static void cloneCell(Cell cNew, Cell cOld) {
cNew.setCellComment(cOld.getCellComment());
cNew.setCellStyle(cOld.getCellStyle());
switch (cNew.getCellType()) {
case Cell.CELL_TYPE_BOOLEAN: {
cNew.setCellValue(cOld.getBooleanCellValue());
break;
}
case Cell.CELL_TYPE_NUMERIC: {
cNew.setCellValue(cOld.getNumericCellValue());
break;
}
case Cell.CELL_TYPE_STRING: {
cNew.setCellValue(cOld.getStringCellValue());
break;
}
case Cell.CELL_TYPE_ERROR: {
cNew.setCellValue(cOld.getErrorCellValue());
break;
}
case Cell.CELL_TYPE_FORMULA: {
cNew.setCellFormula(cOld.getCellFormula());
break;
}
}
}
}
代码示例来源:origin: zhangdaiscott/jeasypoi
private static void cloneCell(Cell cNew, Cell cOld) {
cNew.setCellComment(cOld.getCellComment());
cNew.setCellStyle(cOld.getCellStyle());
switch (cNew.getCellType()) {
case Cell.CELL_TYPE_BOOLEAN: {
cNew.setCellValue(cOld.getBooleanCellValue());
break;
}
case Cell.CELL_TYPE_NUMERIC: {
cNew.setCellValue(cOld.getNumericCellValue());
break;
}
case Cell.CELL_TYPE_STRING: {
cNew.setCellValue(cOld.getStringCellValue());
break;
}
case Cell.CELL_TYPE_ERROR: {
cNew.setCellValue(cOld.getErrorCellValue());
break;
}
case Cell.CELL_TYPE_FORMULA: {
cNew.setCellFormula(cOld.getCellFormula());
break;
}
}
}
}
代码示例来源:origin: xiaolanglang/easypoi
private static void cloneCell(Cell cNew, Cell cOld) {
cNew.setCellComment(cOld.getCellComment());
cNew.setCellStyle(cOld.getCellStyle());
switch (cNew.getCellType()) {
case Cell.CELL_TYPE_BOOLEAN: {
cNew.setCellValue(cOld.getBooleanCellValue());
break;
}
case Cell.CELL_TYPE_NUMERIC: {
cNew.setCellValue(cOld.getNumericCellValue());
break;
}
case Cell.CELL_TYPE_STRING: {
cNew.setCellValue(cOld.getStringCellValue());
break;
}
case Cell.CELL_TYPE_ERROR: {
cNew.setCellValue(cOld.getErrorCellValue());
break;
}
case Cell.CELL_TYPE_FORMULA: {
cNew.setCellFormula(cOld.getCellFormula());
break;
}
}
}
}
代码示例来源:origin: stackoverflow.com
styleOut.setDataFormat(styleIn.getDataFormat());
cellOut.setCellComment(cellIn.getCellComment());
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
Comment comment = cell.getCellComment();
if(includeCellComments && comment != null) {
代码示例来源:origin: org.jxls/jxls-poi
private void readCellGeneralInfo(Cell cell) {
hyperlink = cell.getHyperlink();
try {
comment = cell.getCellComment();
} catch (Exception e) {
logger.error("Failed to read cell comment at " + new CellReference(cell).formatAsString(), e);
return;
}
if(comment != null ){
commentAuthor = comment.getAuthor();
}
if( comment != null && comment.getString() != null ){
String commentString = comment.getString().getString();
String[] commentLines = commentString.split("\\n");
for(String commentLine : commentLines ){
if( isJxlsParamsComment(commentLine)){
processJxlsParams(commentLine);
comment = null;
return;
}
}
setCellComment(commentString);
}
}
代码示例来源:origin: stackoverflow.com
if (newCell.getCellComment() != null) {
newCell.setCellComment(oldCell.getCellComment());
代码示例来源:origin: com.github.nic-luo/rober-office
if (srcCell.getCellComment() != null) {
distCell.setCellComment(srcCell.getCellComment());
代码示例来源:origin: com.phloc/phloc-poi
if (aSource.getCellComment () != null)
aTarget.setCellComment (aSource.getCellComment ());
代码示例来源:origin: stackoverflow.com
if (oldCell.getCellComment() != null) {
newCell.setCellComment(oldCell.getCellComment());
代码示例来源:origin: org.jxls/jxls-poi
public void clearCell(CellRef cellRef) {
if (cellRef == null || cellRef.getSheetName() == null) return;
Sheet sheet = workbook.getSheet(cellRef.getSheetName());
if (sheet == null) return;
removeCellComment(sheet, cellRef.getRow(), cellRef.getCol());
Row row = sheet.getRow(cellRef.getRow());
if (row == null) return;
Cell cell = row.getCell(cellRef.getCol());
if (cell == null) {
CellAddress cellAddress = new CellAddress(cellRef.getRow(), cellRef.getCol());
if (sheet.getCellComment(cellAddress) != null) {
cell = row.createCell(cellRef.getCol());
cell.removeCellComment();
}
return;
}
cell.setCellType(CellType.BLANK);
cell.setCellStyle(workbook.getCellStyleAt(0));
if (cell.getCellComment() != null) {
cell.removeCellComment();
}
findAndRemoveExistingCellRegion(cellRef);
}
代码示例来源:origin: micromata/projectforge
if (oldCell.getCellComment() != null) {
newCell.setCellComment(oldCell.getCellComment());
代码示例来源:origin: ZuInnoTe/hadoopoffice
formula = currentCell.getCellFormula();
Comment currentCellComment = currentCell.getCellComment();
String comment = "";
if (currentCellComment!=null) {
代码示例来源:origin: com.gitee.zhaohuihua/zhh-tools
public static void copyCell(Cell src, Cell target, boolean copyValue) {
if (src == null || target == null) {
return;
}
// 复制样式
target.setCellStyle(src.getCellStyle());
// 单元格类型
int cellType = src.getCellType();
target.setCellType(cellType);
if (cellType == Cell.CELL_TYPE_FORMULA) { // 公式
target.setCellFormula(src.getCellFormula());
} else if (copyValue) { // 复制内容
if (cellType == Cell.CELL_TYPE_ERROR) { // 错误
target.setCellErrorValue(src.getErrorCellValue());
} else {
Object value = getCellValue(src);
setCellValue(target, value);
}
// 评论
Comment comment = src.getCellComment();
if (comment == null) {
target.removeCellComment();
} else {
target.setCellComment(comment);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!