Package org.apache.poi.hssf.record

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


        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

        // we'll need multiple editions for
        // the different formats

       
        switch (id) {
            case 0: return new FormatRecord(5, BuiltinFormats.getBuiltinFormat(5));
            case 1: return new FormatRecord(6, BuiltinFormats.getBuiltinFormat(6));
            case 2: return new FormatRecord(7, BuiltinFormats.getBuiltinFormat(7));
            case 3: return new FormatRecord(8, BuiltinFormats.getBuiltinFormat(8));
            case 4: return new FormatRecord(0x2a, BuiltinFormats.getBuiltinFormat(0x2a));
            case 5: return new FormatRecord(0x29, BuiltinFormats.getBuiltinFormat(0x29));
            case 6: return new FormatRecord(0x2c, BuiltinFormats.getBuiltinFormat(0x2c));
            case 7: return new FormatRecord(0x2b, BuiltinFormats.getBuiltinFormat(0x2b));
        }
        throw new  IllegalArgumentException("Unexpected id " + id);
    }
View Full Code Here

     * @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

        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

    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

     * @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

    {
        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

   *  pass it on to the child Listener.
   * @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

   *  given number format index.
   */
  public String getFormatString(int formatIndex) {
      String format = null;
      if(formatIndex >= HSSFDataFormat.getNumberOfBuiltinBuiltinFormats()) {
        FormatRecord tfr = (FormatRecord)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

TOP

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

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.