Exemplo n.º 1
0
  /**
   * Set the style for the cell. The style should be an XSSFCellStyle created/retreived from the
   * XSSFWorkbook.
   *
   * @param style reference contained in the workbook. If the value is null then the style
   *     information is removed causing the cell to used the default workbook style.
   */
  public void setCellStyle(CellStyle style) {
    if (style == null) {
      if (_cell.isSetS()) _cell.unsetS();
    } else {
      XSSFCellStyle xStyle = (XSSFCellStyle) style;
      xStyle.verifyBelongsToStylesSource(_stylesSource);

      long idx = _stylesSource.putStyle(xStyle);
      _cell.setS(idx);
    }
  }