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) { throw new RuntimeException("Could not find 'internal references' EXTERNALBOOK"); } //Trying to find reference to this sheet int i = _externSheetRecord.getRefIxForSheet(thisWbIndex, firstSheetIndex, lastSheetIndex); if (i >= 0) { return i; } //We haven't found reference to this sheet return _externSheetRecord.addRef(thisWbIndex, firstSheetIndex, lastSheetIndex); }
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); } return result; }
public int linkExternalWorkbook(String name, Workbook externalWorkbook) { int extBookIndex = getExternalWorkbookIndex(name); if (extBookIndex != -1) { // Already linked! return extBookIndex; } // Create a new SupBookRecord String[] sheetNames = new String[externalWorkbook.getNumberOfSheets()]; for (int sn = 0; sn < sheetNames.length; sn++) { sheetNames[sn] = externalWorkbook.getSheetName(sn); } String url = "\000" + name; ExternalBookBlock block = new ExternalBookBlock(url, sheetNames); // Add it into the list + records extBookIndex = extendExternalBookBlocks(block); // add the created SupBookRecord before ExternSheetRecord int idx = findFirstRecordLocBySid(ExternSheetRecord.sid); if (idx == -1) { idx = _workbookRecordList.size(); } _workbookRecordList.add(idx, block.getExternalBookRecord()); // Setup links for the sheets for (int sn = 0; sn < sheetNames.length; sn++) { _externSheetRecord.addRef(extBookIndex, sn, sn); } // Report where it went return extBookIndex; }
_externSheetRecord.addRef(_externalBookBlocks.length - 1, -2, -2);
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) { throw new RuntimeException("Could not find 'internal references' EXTERNALBOOK"); } //Trying to find reference to this sheet int i = _externSheetRecord.getRefIxForSheet(thisWbIndex, firstSheetIndex, lastSheetIndex); if (i >= 0) { return i; } //We haven't found reference to this sheet return _externSheetRecord.addRef(thisWbIndex, firstSheetIndex, lastSheetIndex); }
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) { throw new RuntimeException("Could not find 'internal references' EXTERNALBOOK"); } //Trying to find reference to this sheet int i = _externSheetRecord.getRefIxForSheet(thisWbIndex, sheetIndex); if (i>=0) { return i; } //We haven't found reference to this sheet return _externSheetRecord.addRef(thisWbIndex, sheetIndex, sheetIndex); }
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) { throw new RuntimeException("Could not find 'internal references' EXTERNALBOOK"); } //Trying to find reference to this sheet int i = _externSheetRecord.getRefIxForSheet(thisWbIndex, sheetIndex); if (i>=0) { return i; } //We haven't found reference to this sheet return _externSheetRecord.addRef(thisWbIndex, sheetIndex, sheetIndex); }
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); } return result; }
public int linkExternalWorkbook(String name, Workbook externalWorkbook) { int extBookIndex = getExternalWorkbookIndex(name); if (extBookIndex != -1) { // Already linked! return extBookIndex; } // Create a new SupBookRecord String[] sheetNames = new String[externalWorkbook.getNumberOfSheets()]; for (int sn = 0; sn < sheetNames.length; sn++) { sheetNames[sn] = externalWorkbook.getSheetName(sn); } String url = "\000" + name; ExternalBookBlock block = new ExternalBookBlock(url, sheetNames); // Add it into the list + records extBookIndex = extendExternalBookBlocks(block); // add the created SupBookRecord before ExternSheetRecord int idx = findFirstRecordLocBySid(ExternSheetRecord.sid); if (idx == -1) { idx = _workbookRecordList.size(); } _workbookRecordList.add(idx, block.getExternalBookRecord()); // Setup links for the sheets for (int sn = 0; sn < sheetNames.length; sn++) { _externSheetRecord.addRef(extBookIndex, sn, sn); } // Report where it went return extBookIndex; }
_externSheetRecord.addRef(_externalBookBlocks.length - 1, -2, -2);
_externSheetRecord.addRef(_externalBookBlocks.length - 1, -2, -2);
_externSheetRecord.addRef(_externalBookBlocks.length - 1, -2, -2);