Package org.apache.poi.hssf.record

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


        //remove the sheet that needs to be reordered and place it in the spot we want
        boundsheets.add(pos, boundsheets.remove(sheetNumber));
       
        // also adjust order of Records, calculate the position of the Boundsheets via getBspos()...
        int pos0 = records.getBspos() - (boundsheets.size() - 1);
        Record removed = records.get(pos0 + sheetNumber);
        records.remove(pos0 + sheetNumber);
    records.add(pos0 + pos, removed);
    }
View Full Code Here


     */
    public StyleRecord getStyleRecord(int xfIndex) {
        // Style records always follow after
        //  the ExtendedFormat records
        for(int i=records.getXfpos(); i<records.size(); i++) {
            Record r = records.get(i);
            if(r instanceof ExtendedFormatRecord) {
                continue;
            }
            if(!(r instanceof StyleRecord)) {
                continue;
View Full Code Here

        // Find the spot
        int addAt = -1;
        for(int i=records.getXfpos(); i<records.size() &&
                addAt == -1; i++) {
            Record r = records.get(i);
            if(r instanceof ExtendedFormatRecord ||
                    r instanceof StyleRecord) {
                // Keep going
            } else {
                addAt = i;
View Full Code Here

        int sstPos = 0;
        boolean wroteBoundSheets = false;
        for ( int k = 0; k < records.size(); k++ )
        {

            Record record = records.get( k );
            int len = 0;
            if (record instanceof SSTRecord)
            {
                sst = (SSTRecord)record;
                sstPos = pos;
            }
            if (record.getSid() == ExtSSTRecord.sid && sst != null)
            {
                record = sst.createExtSSTRecord(sstPos + offset);
            }
            if (record instanceof BoundSheetRecord) {
                 if(!wroteBoundSheets) {
                    for (int i = 0; i < boundsheets.size(); i++) {
                        len+= getBoundSheetRec(i)
                                         .serialize(pos+offset+len, data);
                    }
                    wroteBoundSheets = true;
                 }
            } else {
               len = record.serialize( pos + offset, data );
            }
            /////  DEBUG BEGIN /////
//                if (len != record.getRecordSize())
//                    throw new IllegalStateException("Record size does not match serialized bytes.  Serialized size = " + len + " but getRecordSize() returns " + record.getRecordSize());
            /////  DEBUG END /////
View Full Code Here

        int retval = 0;

        SSTRecord sst = null;
        for ( int k = 0; k < records.size(); k++ )
        {
            Record record = records.get( k );
            if (record instanceof SSTRecord)
                sst = (SSTRecord)record;

            if (record.getSid() == ExtSSTRecord.sid && sst != null)
                retval += sst.calcExtSSTRecordSize();
            else
                retval += record.getRecordSize();
        }

        return retval;
    }
View Full Code Here

    public PaletteRecord getCustomPalette()
    {
      PaletteRecord palette;
      int palettePos = records.getPalettepos();
      if (palettePos != -1) {
        Record rec = records.get(palettePos);
        if (rec instanceof PaletteRecord) {
          palette = (PaletteRecord) rec;
        } else throw new RuntimeException("InternalError: Expected PaletteRecord but got a '"+rec+"'");
      }
      else
View Full Code Here

      HSSFChart lastChart = null;
     
      // Find records of interest
      List records = sheet.getSheet().getRecords();
      for(Iterator it = records.iterator(); it.hasNext();) {
        Record r = (Record)it.next();
       
        if(r instanceof ChartRecord) {
          lastChart = new HSSFChart((ChartRecord)r);
          charts.add(lastChart);
        }
View Full Code Here

    _externalBookBlocks = new ExternalBookBlock[temp.size()];
    temp.toArray(_externalBookBlocks);
    temp.clear();

    // If link table is present, there is always 1 of ExternSheetRecord
    Record next = rs.getNext();
    _externSheetRecord = (ExternSheetRecord)next;
    _definedNames = new ArrayList();
    // collect zero or more DEFINEDNAMEs id=0x18
    while(rs.peekNextClass() == NameRecord.class) {
      NameRecord nr = (NameRecord)rs.getNext();
View Full Code Here

   * copied from Workbook
   */
  private int findFirstRecordLocBySid(short sid) {
    int index = 0;
    for (Iterator iterator = _workbookRecordList.iterator(); iterator.hasNext(); ) {
      Record record = ( Record ) iterator.next();

      if (record.getSid() == sid) {
        return index;
      }
      index ++;
    }
    return -1;
View Full Code Here

   * @param offset - position of {@link CFHeaderRecord} object in the list of Record objects
   * @return CFRecordsAggregate object
   */
  public static CFRecordsAggregate createCFAggregate(List recs, int pOffset)
  {
    Record rec = ( Record ) recs.get(pOffset);
    if (rec.getSid() != CFHeaderRecord.sid) {
      throw new IllegalStateException("next record sid was " + rec.getSid()
          + " instead of " + CFHeaderRecord.sid + " as expected");
    }

    CFHeaderRecord header = (CFHeaderRecord)rec;
    int nRules = header.getNumberOfConditionalFormats();
View Full Code Here

TOP

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

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.