コード例 #1
0
  protected SFont importFont(CellStyle poiCellStyle) {
    SFont font = null;

    final short fontIndex = poiCellStyle.getFontIndex();
    if (importedFont.containsKey(fontIndex)) {
      font = importedFont.get(fontIndex);
    } else {
      Font poiFont = workbook.getFontAt(fontIndex);
      font = createZssFont(poiFont);
      importedFont.put(fontIndex, font); // ZSS-677
    }
    return font;
  }
コード例 #2
0
  protected org.zkoss.poi.ss.usermodel.Font getPoiFontFromRichText(
      Workbook book, Cell cell, RichTextString rstr, int run) {
    if (run < 0) return null; // ZSS-1138

    org.zkoss.poi.ss.usermodel.Font font =
        rstr instanceof HSSFRichTextString
            ? book.getFontAt(((HSSFRichTextString) rstr).getFontOfFormattingRun(run))
            : ((XSSFRichTextString) rstr).getFontOfFormattingRun((XSSFWorkbook) book, run);
    if (font == null) {
      CellStyle style = cell.getCellStyle();
      short fontIndex = style != null ? style.getFontIndex() : (short) 0;
      return book.getFontAt(fontIndex);
    }
    return font;
  }