Package org.apache.poi.hssf.record

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


    }
  }
 
  private int getExternalWorkbookIndex(String workbookName) {
      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
              return i;
          }
      }
      return -1;
  }
View Full Code Here


  public int getExternalSheetIndex(String workbookName, String firstSheetName, String lastSheetName) {
      int externalBookIndex = getExternalWorkbookIndex(workbookName);
        if (externalBookIndex == -1) {
            throw new RuntimeException("No external workbook with name '" + workbookName + "'");
        }
        SupBookRecord ebrTarget = _externalBookBlocks[externalBookIndex].getExternalBookRecord();

    int firstSheetIndex = getSheetIndex(ebrTarget.getSheetNames(), firstSheetName);
        int lastSheetIndex = getSheetIndex(ebrTarget.getSheetNames(), lastSheetName);

        // Find or add the external sheet record definition for this
    int result = _externSheetRecord.getRefIxForSheet(externalBookIndex, firstSheetIndex, lastSheetIndex);
    if (result < 0) {
        result = _externSheetRecord.addRef(externalBookIndex, firstSheetIndex, lastSheetIndex);
View Full Code Here

      return checkExternSheet(sheetIndex, sheetIndex);
  }
    public int checkExternSheet(int firstSheetIndex, int lastSheetIndex) {
    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

        int extBlockIndex = -1;
        ExternalBookBlock extBlock = null;

        // find ExternalBlock for Add-In functions and remember its index
        for (int i = 0; i < _externalBookBlocks.length; i++) {
            SupBookRecord ebr = _externalBookBlocks[i].getExternalBookRecord();
            if (ebr.isAddInFunctions()) {
                extBlock = _externalBookBlocks[i];
                extBlockIndex = i;
                break;
            }
        }
View Full Code Here

   * @param newUrl The URL replacement
   * @return true if the oldUrl was found and replaced with newUrl. Otherwise false
   */
  public boolean changeExternalReference(String oldUrl, String newUrl) {
    for(ExternalBookBlock ex : _externalBookBlocks) {
      SupBookRecord externalRecord = ex.getExternalBookRecord();
      if (externalRecord.isExternalReferences()
        && externalRecord.getURL().equals(oldUrl)) {
       
        externalRecord.setURL(newUrl);
        return true;
      }
    }
    return false;
  }
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

  }

  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

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.