Examples of FormatRecord


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

     * @see org.apache.poi.hssf.record.Record
     */
    public int createFormat(String formatString) {

        maxformatid = maxformatid >= 0xa4 ? maxformatid + 1 : 0xa4; //Starting value from M$ empircal study.
        FormatRecord rec = new FormatRecord(maxformatid, formatString);

        int pos = 0;
        while ( pos < records.size() && records.get( pos ).getSid() != FormatRecord.sid )
            pos++;
        pos += formats.size();
View Full Code Here

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

    {
        this.workbook = workbook;
        Iterator i = workbook.getFormats().iterator();
        while ( i.hasNext() )
        {
            FormatRecord r = (FormatRecord) i.next();
            if ( formats.size() < r.getIndexCode() + 1 )
            {
                formats.setSize( r.getIndexCode() + 1 );
            }
            formats.set( r.getIndexCode(), r.getFormatString() );
        }

    }
View Full Code Here

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

        {
    case SSTRecord.sid:
      sstRecord = (SSTRecord) record;
      break;
    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;
View Full Code Here

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

            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?
View Full Code Here

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

    _workbook = workbook;

    @SuppressWarnings("unchecked")
    Iterator<FormatRecord> i = workbook.getFormats().iterator();
    while (i.hasNext()) {
      FormatRecord r = i.next();
      if (_formats.size() < r.getIndexCode() + 1) {
        _formats.setSize(r.getIndexCode() + 1);
      }
      _formats.set(r.getIndexCode(), r.getFormatString());
    }
  }
View Full Code Here

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

   *
   * @param record
   */
  public void processRecordInternally(Record record) {
    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

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

   * Returns the format string, eg $##.##, for the given number format index.
   */
  public String getFormatString(int formatIndex) {
    String format = null;
    if (formatIndex >= HSSFDataFormat.getNumberOfBuiltinBuiltinFormats()) {
      FormatRecord tfr = _customFormatRecords.get(new Integer(formatIndex));
      if (tfr == null) {
        System.err.println("Requested format at index " + formatIndex
            + ", but it wasn't found");
      } else {
        format = tfr.getFormatString();
      }
    } else {
      format = HSSFDataFormat.getBuiltinFormat((short) formatIndex);
    }
    return format;
View Full Code Here

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

        retval.records.setFontpos( records.size() - 1 );   // last font record position
        retval.numfonts = 4;

        // set up format records
        for (int i = 0; i <= 7; i++) {
            FormatRecord rec = createFormat(i);
            retval.maxformatid = retval.maxformatid >= rec.getIndexCode() ? retval.maxformatid : rec.getIndexCode();
            formats.add(rec);
            records.add(rec);
        }

        for (int k = 0; k < 21; k++) {
View Full Code Here

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

    private static FormatRecord createFormat(int id) {
        // we'll need multiple editions for
        // the different formats

        switch (id) {
            case 0: return new FormatRecord(5, "\"$\"#,##0_);\\(\"$\"#,##0\\)");
            case 1: return new FormatRecord(6, "\"$\"#,##0_);[Red]\\(\"$\"#,##0\\)");
            case 2: return new FormatRecord(7, "\"$\"#,##0.00_);\\(\"$\"#,##0.00\\)");
            case 3: return new FormatRecord(8, "\"$\"#,##0.00_);[Red]\\(\"$\"#,##0.00\\)");
            case 4: return new FormatRecord(0x2a, "_(\"$\"* #,##0_);_(\"$\"* \\(#,##0\\);_(\"$\"* \"-\"_);_(@_)");
            case 5: return new FormatRecord(0x29, "_(* #,##0_);_(* \\(#,##0\\);_(* \"-\"_);_(@_)");
            case 6: return new FormatRecord(0x2c, "_(\"$\"* #,##0.00_);_(\"$\"* \\(#,##0.00\\);_(\"$\"* \"-\"??_);_(@_)");
            case 7: return new FormatRecord(0x2b, "_(* #,##0.00_);_(* \\(#,##0.00\\);_(* \"-\"??_);_(@_)");
        }
        throw new  IllegalArgumentException("Unexpected id " + id);
    }
View Full Code Here

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

     * @return the format id of a format that matches or -1 if none found and createIfNotFound
     */
    public short getFormat(String format, boolean createIfNotFound) {
    Iterator iterator;
    for (iterator = formats.iterator(); iterator.hasNext();) {
        FormatRecord r = (FormatRecord)iterator.next();
        if (r.getFormatString().equals(format)) {
        return (short)r.getIndexCode();
        }
    }

    if (createIfNotFound) {
        return (short)createFormat(format);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.