Package org.apache.poi.hssf.record

Examples of org.apache.poi.hssf.record.ExtendedFormatRecord


     * @return the new Cell Style object
     */

    public HSSFCellStyle createCellStyle()
    {
        ExtendedFormatRecord xfr = workbook.createCellXF();
        short index = (short) (getNumCellStyles() - 1);
        HSSFCellStyle style = new HSSFCellStyle(index, xfr, this);

        return style;
    }
View Full Code Here


     * @return HSSFCellStyle object at the index
     */

    public HSSFCellStyle getCellStyleAt(short idx)
    {
        ExtendedFormatRecord xfr = workbook.getExFormatAt(idx);
        HSSFCellStyle style = new HSSFCellStyle(idx, xfr, this);

        return style;
    }
View Full Code Here

            case CELL_TYPE_FORMULA :
                _stringValue=new HSSFRichTextString(((FormulaRecordAggregate) cval).getStringValue());
                break;
        }
        ExtendedFormatRecord xf = book.getWorkbook().getExFormatAt(cval.getXFIndex());

        setCellStyle(new HSSFCellStyle(cval.getXFIndex(), xf, book));
    }
View Full Code Here

     * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short)
     */
    public HSSFCellStyle getCellStyle()
    {
      short styleIndex=_record.getXFIndex();
      ExtendedFormatRecord xf = _book.getWorkbook().getExFormatAt(styleIndex);
      return new HSSFCellStyle(styleIndex, xf, _book);
    }
View Full Code Here

     {@link #isFormatted()} to check first.
     */
    public HSSFCellStyle getRowStyle() {
        if(!isFormatted()) { return null; }
        short styleIndex = row.getXFIndex();
        ExtendedFormatRecord xf = book.getWorkbook().getExFormatAt(styleIndex);
        return new HSSFCellStyle(styleIndex, xf, book);
    }
View Full Code Here

    case FormatRecord.sid:
      FormatRecord fr = (FormatRecord) record;
      customFormatRecords.put(new Integer(fr.getIndexCode()), fr);
      break;
    case ExtendedFormatRecord.sid:
      ExtendedFormatRecord xr = (ExtendedFormatRecord) record;
      xfRecords.add(xr);
      break;
     
        case BlankRecord.sid:
          BlankRecord brec = (BlankRecord) record;
View Full Code Here

   * Formats a number or date cell, be that a real number, or the
   *  answer to a formula
   */
  private String formatNumberDateCell(CellValueRecordInterface cell, double value) {
        // Get the built in format, if there is one
        ExtendedFormatRecord xfr = (ExtendedFormatRecord)
          xfRecords.get(cell.getXFIndex());
        if(xfr == null) {
          System.err.println("Cell " + cell.getRow() + "," + cell.getColumn() + " uses XF with index " + cell.getXFIndex() + ", but we don't have that");
            return Double.toString(value);
        } else {
          int formatIndex = xfr.getFormatIndex();
          String format;
          if(formatIndex >= HSSFDataFormat.getNumberOfBuiltinBuiltinFormats()) {
            FormatRecord tfr = (FormatRecord)customFormatRecords.get(new Integer(formatIndex));
            format = tfr.getFormatString();
          } else {
              format = HSSFDataFormat.getBuiltinFormat(xfr.getFormatIndex());
          }
         
          // Is it a date?
          if(HSSFDateUtil.isADateFormat(formatIndex,format) &&
              HSSFDateUtil.isValidExcelDate(value)) {
View Full Code Here

    if (record instanceof FormatRecord) {
      FormatRecord fr = (FormatRecord) record;
      _customFormatRecords.put(new Integer(fr.getIndexCode()), fr);
    }
    if (record instanceof ExtendedFormatRecord) {
      ExtendedFormatRecord xr = (ExtendedFormatRecord) record;
      _xfRecords.add(xr);
    }
  }
View Full Code Here

  /**
   * Returns the index of the format string, used by your cell, or -1 if none
   * found
   */
  public int getFormatIndex(CellValueRecordInterface cell) {
    ExtendedFormatRecord xfr = _xfRecords.get(cell.getXFIndex());
    if (xfr == null) {
      System.err.println("Cell " + cell.getRow() + "," + cell.getColumn()
          + " uses XF with index " + cell.getXFIndex() + ", but we don't have that");
      return -1;
    }
    return xfr.getFormatIndex();
  }
View Full Code Here

    public ExtendedFormatRecord getExFormatAt(int index) {
        int xfptr = records.getXfpos() - (numxfs - 1);

        xfptr += index;
        ExtendedFormatRecord retval =
        ( ExtendedFormatRecord ) records.get(xfptr);

        return retval;
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.ExtendedFormatRecord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.