Package org.apache.poi.hssf.record

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


  }

  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


    _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

    /**
     * tests that we can load the record
     */
    public void testLoadIR() {

        SupBookRecord record = new SupBookRecord(TestcaseRecordInputStream.create(0x01AE, dataIR));     
        assertTrue( record.isInternalReferences() );             //expected flag
        assertEquals( 0x4, record.getNumberOfSheets() );    //expected # of sheets

        assertEquals( 8, record.getRecordSize() )//sid+size+data
    }
View Full Code Here

    /**
     * tests that we can load the record
     */
    public void testLoadER() {

        SupBookRecord record = new SupBookRecord(TestcaseRecordInputStream.create(0x01AE, dataER));     
        assertTrue( record.isExternalReferences() );             //expected flag
        assertEquals( 0x2, record.getNumberOfSheets() );    //expected # of sheets

        assertEquals( 34, record.getRecordSize() )//sid+size+data
       
        assertEquals("testURL", record.getURL());
        String[] sheetNames = record.getSheetNames();
        assertEquals(2, sheetNames.length);
        assertEquals("Sheet1", sheetNames[0]);
        assertEquals("Sheet2", sheetNames[1]);
    }
View Full Code Here

    /**
     * tests that we can load the record
     */
    public void testLoadAIF() {

        SupBookRecord record = new SupBookRecord(TestcaseRecordInputStream.create(0x01AE, dataAIF));     
        assertTrue( record.isAddInFunctions() );             //expected flag
        assertEquals( 0x1, record.getNumberOfSheets() );    //expected # of sheets
        assertEquals( 8, record.getRecordSize() )//sid+size+data
    }
View Full Code Here

    /**
     * Tests that we can store the record
     *
     */
    public void testStoreIR() {
        SupBookRecord record = SupBookRecord.createInternalReferences((short)4);

        TestcaseRecordInputStream.confirmRecordEncoding(0x01AE, dataIR, record.serialize());
    }  
View Full Code Here

    }  
   
    public void testStoreER() {
        String url = "testURL";
        String[] sheetNames = { "Sheet1", "Sheet2", };
        SupBookRecord record = SupBookRecord.createExternalReferences(url, sheetNames);

        TestcaseRecordInputStream.confirmRecordEncoding(0x01AE, dataER, record.serialize());
    }
View Full Code Here

        TestcaseRecordInputStream.confirmRecordEncoding(0x01AE, dataER, record.serialize());
    }

    public void testStoreAIF() {
        SupBookRecord record = SupBookRecord.createAddInFunctions();
        assertEquals(1, record.getNumberOfSheets());
        assertTrue(record.isAddInFunctions());
        TestcaseRecordInputStream.confirmRecordEncoding(0x01AE, dataAIF, record.serialize());
    }
View Full Code Here

   
    public void testExternalReferenceUrl() {
      String[] sheetNames = new String[]{"SampleSheet"};
      final char startMarker = (char)1;
     
    SupBookRecord record;
   
    record = new SupBookRecord(startMarker + "test.xls", sheetNames);
      assertEquals("test.xls", record.getURL());

      //UNC path notation
      record = new SupBookRecord(startMarker + "" + CH_VOLUME + "@servername" + CH_DOWN_DIR + "test.xls", sheetNames);
      assertEquals("\\\\servername" + PATH_SEPERATOR + "test.xls", record.getURL());
     
      //Absolute path notation - different device
      record = new SupBookRecord(startMarker + "" + CH_VOLUME + "D" + CH_DOWN_DIR + "test.xls", sheetNames);
      assertEquals("D:" + PATH_SEPERATOR + "test.xls", record.getURL());

      //Absolute path notation - same device
      record = new SupBookRecord(startMarker + "" + CH_SAME_VOLUME + "folder" + CH_DOWN_DIR + "test.xls", sheetNames);
      assertEquals(PATH_SEPERATOR + "folder" + PATH_SEPERATOR + "test.xls", record.getURL());
     
      //Relative path notation - down
      record = new SupBookRecord(startMarker + "folder" + CH_DOWN_DIR + "test.xls", sheetNames);
      assertEquals("folder" + PATH_SEPERATOR + "test.xls", record.getURL());
     
      //Relative path notation - up
      record = new SupBookRecord(startMarker +""+ CH_UP_DIR + "test.xls", sheetNames);
      assertEquals(".." + PATH_SEPERATOR + "test.xls", record.getURL());

      //Relative path notation - for EXCEL.exe - fallback
      record = new SupBookRecord(startMarker +""+ CH_STARTUP_DIR + "test.xls", sheetNames);
      assertEquals("." + PATH_SEPERATOR + "test.xls", record.getURL());

      //Relative path notation - for EXCEL lib folder - fallback
      record = new SupBookRecord(startMarker +""+ CH_LIB_DIR + "test.xls", sheetNames);
      assertEquals("." + PATH_SEPERATOR + "test.xls", record.getURL());

      //Relative path notation - for alternative EXCEL.exe - fallback
      record = new SupBookRecord(startMarker +""+ CH_ALT_STARTUP_DIR+ "test.xls", sheetNames);
      assertEquals("." + PATH_SEPERATOR + "test.xls", record.getURL());
    }
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.