Package org.apache.poi.hssf.record

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


    _externSheetRecord = new ExternSheetRecord();
    _recordCount = 2;

    // tell _workbookRecordList about the 2 new records

    SupBookRecord supbook = _externalBookBlocks[0].getExternalBookRecord();

    int idx = findFirstRecordLocBySid(CountryRecord.sid);
    if(idx < 0) {
      throw new RuntimeException("CountryRecord not found");
    }
View Full Code Here


    _externSheetRecord = new ExternSheetRecord();
    _recordCount = 2;

    // tell _workbookRecordList about the 2 new records

    SupBookRecord supbook = _externalBookBlocks[0].getExternalBookRecord();

    int idx = findFirstRecordLocBySid(CountryRecord.sid);
    if(idx < 0) {
      throw new RuntimeException("CountryRecord not found");
    }
View Full Code Here

    return lastName.getSheetNumber() == firstName.getSheetNumber();
  }

  public String[] getExternalBookAndSheetName(int extRefIndex) {
    int ebIx = _externSheetRecord.getExtbookIndexFromRefIndex(extRefIndex);
    SupBookRecord ebr = _externalBookBlocks[ebIx].getExternalBookRecord();
    if (!ebr.isExternalReferences()) {
      return null;
    }
    int shIx = _externSheetRecord.getFirstSheetIndexFromRefIndex(extRefIndex);
    String usSheetName = ebr.getSheetNames()[shIx];
    return new String[] {
        ebr.getURL(),
        usSheetName,
    };
  }
View Full Code Here

        usSheetName,
    };
  }

  public int getExternalSheetIndex(String workbookName, String sheetName) {
    SupBookRecord ebrTarget = null;
    int externalBookIndex = -1;
    for (int i=0; i<_externalBookBlocks.length; i++) {
      SupBookRecord ebr = _externalBookBlocks[i].getExternalBookRecord();
      if (!ebr.isExternalReferences()) {
        continue;
      }
      if (workbookName.equals(ebr.getURL())) { // not sure if 'equals()' works when url has a directory
        ebrTarget = ebr;
        externalBookIndex = i;
        break;
      }
    }
View Full Code Here

  }

  public int checkExternSheet(int sheetIndex) {
    int thisWbIndex = -1; // this is probably always zero
    for (int i=0; i<_externalBookBlocks.length; i++) {
      SupBookRecord ebr = _externalBookBlocks[i].getExternalBookRecord();
      if (ebr.isInternalReferences()) {
        thisWbIndex = i;
        break;
      }
    }
    if (thisWbIndex < 0) {
View Full Code Here

        //    [EXTERNSHEET]
        //    [EOFRecord]

        assertEquals(5, wrl.getRecords().size());
        assertTrue(wrl.get(2) instanceof SupBookRecord);
        SupBookRecord sup1 = (SupBookRecord)wrl.get(2);
        assertEquals(numberOfSheets, sup1.getNumberOfSheets());
        assertTrue(wrl.get(3) instanceof ExternSheetRecord);
        ExternSheetRecord extSheet = (ExternSheetRecord)wrl.get(3);
        assertEquals(0, extSheet.getNumOfRefs());

        assertNull(tbl.getNameXPtg("ISODD", -1));
        assertEquals(5, wrl.getRecords().size()); //still have five records

        NameXPtg namex1 = tbl.addNameXPtg("ISODD")// adds two new rercords
        assertEquals(0, namex1.getSheetRefIndex());
        assertEquals(0, namex1.getNameIndex());
        assertEquals(namex1.toString(), tbl.getNameXPtg("ISODD", -1).toString());
       
        // Can only find on the right sheet ref, if restricting
        assertEquals(namex1.toString(), tbl.getNameXPtg("ISODD", 0).toString());
        assertNull(tbl.getNameXPtg("ISODD", 1));
        assertNull(tbl.getNameXPtg("ISODD", 2));
       
        // assure they are in place:
        //    [BOFRecord]
        //    [CountryRecord]
        //    [SUPBOOK Internal References  nSheets= 3]
        //    [SUPBOOK Add-In Functions nSheets= 1]
        //    [EXTERNALNAME .name    = ISODD]
        //    [EXTERNSHEET]
        //    [EOFRecord]

        assertEquals(7, wrl.getRecords().size());
        assertTrue(wrl.get(3) instanceof SupBookRecord);
        SupBookRecord sup2 = (SupBookRecord)wrl.get(3);
        assertTrue(sup2.isAddInFunctions());
        assertTrue(wrl.get(4) instanceof ExternalNameRecord);
        ExternalNameRecord ext1 = (ExternalNameRecord)wrl.get(4);
        assertEquals("ISODD", ext1.getText());
        assertTrue(wrl.get(5) instanceof ExternSheetRecord);
        assertEquals(1, extSheet.getNumOfRefs());
View Full Code Here

    _externSheetRecord = new ExternSheetRecord();
    _recordCount = 2;

    // tell _workbookRecordList about the 2 new records

    SupBookRecord supbook = _externalBookBlocks[0].getExternalBookRecord();

    int idx = findFirstRecordLocBySid(CountryRecord.sid);
    if(idx < 0) {
      throw new RuntimeException("CountryRecord not found");
    }
View Full Code Here

    _externSheetRecord = new ExternSheetRecord();
    _recordCount = 2;

    // tell _workbookRecordList about the 2 new records

    SupBookRecord supbook = _externalBookBlocks[0].getExternalBookRecord();

    int idx = findFirstRecordLocBySid(CountryRecord.sid);
    if(idx < 0) {
      throw new RuntimeException("CountryRecord not found");
    }
View Full Code Here

    return lastName.getSheetNumber() == firstName.getSheetNumber();
  }

  public String[] getExternalBookAndSheetName(int extRefIndex) {
    int ebIx = _externSheetRecord.getExtbookIndexFromRefIndex(extRefIndex);
    SupBookRecord ebr = _externalBookBlocks[ebIx].getExternalBookRecord();
    if (!ebr.isExternalReferences()) {
      return null;
    }
    // Sheet name only applies if not a global reference
    int shIx = _externSheetRecord.getFirstSheetIndexFromRefIndex(extRefIndex);
    String usSheetName = null;
    if(shIx >= 0) {
       usSheetName = ebr.getSheetNames()[shIx];
    }
    return new String[] {
        ebr.getURL(),
        usSheetName,
    };
  }
View Full Code Here

        usSheetName,
    };
  }

  public int getExternalSheetIndex(String workbookName, String sheetName) {
    SupBookRecord ebrTarget = null;
    int externalBookIndex = -1;
    for (int i=0; i<_externalBookBlocks.length; i++) {
      SupBookRecord ebr = _externalBookBlocks[i].getExternalBookRecord();
      if (!ebr.isExternalReferences()) {
        continue;
      }
      if (workbookName.equals(ebr.getURL())) { // not sure if 'equals()' works when url has a directory
        ebrTarget = ebr;
        externalBookIndex = i;
        break;
      }
    }
View Full Code Here

TOP

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

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.