Package org.apache.poi.hssf.record

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


      case BoundSheetRecord.sid:
        BoundSheetRecord sr = (BoundSheetRecord)record;
        sheetNames.add(sr.getSheetname());
        break;
      case BOFRecord.sid:
        BOFRecord bof = (BOFRecord)record;
        if(bof.getType() == BOFRecord.TYPE_WORKSHEET) {
          sheetNum++;
          rowNum = -1;
         
          if(includeSheetNames) {
            if(text.length() > 0) text.append("\n");
View Full Code Here


    {
       if (rec.getSid() == BOFRecord.sid) {
             if (lastEOF != true) {
              throw new RuntimeException("Not yet handled embedded models")
             } else {
              BOFRecord bof = (BOFRecord)rec;
              switch (bof.getType()) {
               case BOFRecord.TYPE_WORKBOOK:
                 currentmodel = new Workbook();                
               break;
               case BOFRecord.TYPE_WORKSHEET:
                 currentmodel = new Sheet();                                 
               break;
              default:
                   throw new RuntimeException("Unsupported model type "+bof.getType());
              }               
              
             }       
        }
       
View Full Code Here

                           (rec.getSid() == BOFRecord.sid));                 
                return true;             
            }
        }, new short[] {BOFRecord.sid});
       
        BOFRecord bof = new BOFRecord();
        bof.setBuild((short)0);
        bof.setBuildYear((short)1999);
        bof.setRequiredVersion(123);
        bof.setType(BOFRecord.TYPE_WORKBOOK);
        bof.setVersion((short)0x06);
        bof.setHistoryBitMask(BOFRecord.HISTORY_MASK);
       
        EOFRecord eof = new EOFRecord();
        bytes = new byte[bof.getRecordSize() + eof.getRecordSize()];
        offset = bof.serialize(offset,bytes);
        offset = eof.serialize(offset,bytes);
               
        factory.processRecords(new ByteArrayInputStream(bytes));   
        assertTrue("The record listener must be called",wascalled);   
    }
View Full Code Here

    public void testCreateRecord()
    {
        byte[] bytes = null;
        byte[] nbytes = null;
        Record[] records = null;
        BOFRecord bof = new BOFRecord();
        bof.setBuild((short)0);
        bof.setBuildYear((short)1999);
        bof.setRequiredVersion(123);
        bof.setType(BOFRecord.TYPE_WORKBOOK);
        bof.setVersion((short)0x06);
        bof.setHistoryBitMask(BOFRecord.HISTORY_MASK);
       
        bytes = bof.serialize();
        nbytes = new byte[bytes.length - 4];
        System.arraycopy(bytes,4,nbytes,0,nbytes.length);
           
        records = factory.createRecord(new TestcaseRecordInputStream(bof.getSid(),(short)nbytes.length,nbytes));
       
        assertTrue("record.length must be 1, was ="+records.length,records.length == 1);
        assertTrue("record is the same", compareRec(bof,records[0]));
       
    }
View Full Code Here

    {
       if (rec.getSid() == BOFRecord.sid) {
             if (lastEOF != true) {
              throw new RuntimeException("Not yet handled embedded models")
             } else {
              BOFRecord bof = (BOFRecord)rec;
              switch (bof.getType()) {
               case BOFRecord.TYPE_WORKBOOK:
                 currentmodel = new Workbook();                
               break;
               case BOFRecord.TYPE_WORKSHEET:
                 currentmodel = new Sheet();                                 
               break;
              default:
                   throw new RuntimeException("Unsupported model type "+bof.getType());
              }               
              
             }       
        }
       
View Full Code Here

                           (rec.getSid() == BOFRecord.sid));                 
                return true;             
            }
        }, new short[] {BOFRecord.sid});
       
        BOFRecord bof = new BOFRecord();
        bof.setBuild((short)0);
        bof.setBuildYear((short)1999);
        bof.setRequiredVersion(123);
        bof.setType(BOFRecord.TYPE_WORKBOOK);
        bof.setVersion((short)0x06);
        bof.setHistoryBitMask(BOFRecord.HISTORY_MASK);
       
        EOFRecord eof = new EOFRecord();
        bytes = new byte[bof.getRecordSize() + eof.getRecordSize()];
        offset = bof.serialize(offset,bytes);
        offset = eof.serialize(offset,bytes);
               
        factory.processRecords(new ByteArrayInputStream(bytes));   
        assertTrue("The record listener must be called",wascalled);   
    }
View Full Code Here

    public void testCreateRecord()
    {
        byte[] bytes = null;
        byte[] nbytes = null;
        Record[] records = null;
        BOFRecord bof = new BOFRecord();
        bof.setBuild((short)0);
        bof.setBuildYear((short)1999);
        bof.setRequiredVersion(123);
        bof.setType(BOFRecord.TYPE_WORKBOOK);
        bof.setVersion((short)0x06);
        bof.setHistoryBitMask(BOFRecord.HISTORY_MASK);
       
        bytes = bof.serialize();
        nbytes = new byte[bytes.length - 4];
        System.arraycopy(bytes,4,nbytes,0,nbytes.length);
           
        records = factory.createRecord(bof.getSid(),(short)nbytes.length,nbytes);
       
        assertTrue("record.length must be 1, was ="+records.length,records.length == 1);
        assertTrue("record is the same", compareRec(bof,records[0]));
       
    }
View Full Code Here

        if (rs.peekNextSid() != BOFRecord.sid) {
            throw new RuntimeException("BOF record expected");
        }
       
        BOFRecord bof = (BOFRecord) rs.getNext();
        if (bof.getType() == BOFRecord.TYPE_WORKSHEET) {
            // Good, well supported
        } else if (bof.getType() == BOFRecord.TYPE_CHART ||
                   bof.getType() == BOFRecord.TYPE_EXCEL_4_MACRO) {
            // These aren't really typical sheets... Let it go though,
            //  we can handle them roughly well enough as a "normal" one
        } else {
            // Not a supported type
            // Skip onto the EOF, then complain
            while (rs.hasNext()) {
                Record rec = rs.getNext();
                if (rec instanceof EOFRecord) {
                    break;
                }
            }
            throw new UnsupportedBOFType(bof.getType());
        }
        records.add(bof);
       
        while (rs.hasNext()) {
            int recSid = rs.peekNextSid();
View Full Code Here

    /**
     * creates the BOF record
     */
    /* package */ static BOFRecord createBOF() {
        BOFRecord retval = new BOFRecord();

        retval.setVersion(( short ) 0x600);
        retval.setType(( short ) 0x010);

        retval.setBuild(( short ) 0x0dbb);
        retval.setBuildYear(( short ) 1996);
        retval.setHistoryBitMask(0xc1);
        retval.setRequiredVersion(0x6);
        return retval;
    }
View Full Code Here

        return r;
    }

    private BOFRecord createBOFRecord()
    {
        BOFRecord r = new BOFRecord();
        r.setVersion((short)600);
        r.setType((short)20);
        r.setBuild((short)0x1CFE);
        r.setBuildYear((short)1997);
        r.setHistoryBitMask(0x40C9);
        r.setRequiredVersion(106);
        return r;
    }
View Full Code Here

TOP

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

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.