2
异常代码
@Override
public void afterRowDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row
, Integer relativeRowIndex, Boolean isHead) {
//边框样式
Cell cell = row.getCell(2) == null ? row.createCell(2) : row.getCell(2);
Object curData = cell.getCellType() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue();
if(curData.toString().equals("11o23¤")){
Font fontRed = cell.getSheet().getWorkbook().createFont();
fontRed.setColor(Font.COLOR_RED);
Font fontRedSuperscript = cell.getSheet().getWorkbook().getFontAt(2);
fontRedSuperscript.setColor(Font.COLOR_RED);
fontRedSuperscript.setTypeOffset(Font.SS_SUPER);
CellUtil.setFont(cell, fontRed);
cell.getRichStringCellValue().applyFont(2, 3, fontRedSuperscript);
}
}
异常提示
问题描述
表格数据中想设置某个字符为上下标。比如“11o23¤”中23为上标。麻烦帮忙解答下,谢谢。