Examples of FormatRecord


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(Integer.valueOf(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(Integer.valueOf(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

                    }
                    break;

                /* FormatRecord */
                case FormatRecord.sid:
                    FormatRecord formatRecord = (FormatRecord)record;
                    String dataFormat = formatRecord.getFormatString();
                    short formatIdx = formatRecord.getIndexCode();
                    formats.put(formatIdx, dataFormat);
                    if (log.isDebugEnabled()) {
                        debug(record, "[" + formatIdx + "]=[" + dataFormat + "]");
                    }
                    break;
View Full Code Here

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

        this.workbook = workbook;
        if ( builtinFormats == null ) populateBuiltinFormats();
        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

    {
        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

        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

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

        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
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.