Esempio n. 1
0
 /**
  * Return the cell's style.
  *
  * @return the cell's style.</code>
  */
 public XSSFCellStyle getCellStyle() {
   XSSFCellStyle style = null;
   if (_stylesSource.getNumCellStyles() > 0) {
     long idx = _cell.isSetS() ? _cell.getS() : 0;
     style = _stylesSource.getStyleAt((int) idx);
   }
   return style;
 }
Esempio n. 2
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);
    }
  }