public void removeSheet(int sheetIdx) { int nItems = _list.size(); for (int i = 0; i < nItems; i++) { RefSubRecord refSubRecord = _list.get(i); if(refSubRecord.getFirstSheetIndex() == sheetIdx && refSubRecord.getLastSheetIndex() == sheetIdx) { // removing the entry would mess up the sheet index in Formula of NameRecord _list.set(i, new RefSubRecord(refSubRecord.getExtBookIndex(), -1, -1)); } else if (refSubRecord.getFirstSheetIndex() > sheetIdx && refSubRecord.getLastSheetIndex() > sheetIdx) { _list.set(i, new RefSubRecord(refSubRecord.getExtBookIndex(), refSubRecord.getFirstSheetIndex()-1, refSubRecord.getLastSheetIndex()-1)); } } }
public int getRefIxForSheet(int externalBookIndex, int firstSheetIndex, int lastSheetIndex) { int nItems = _list.size(); for (int i = 0; i < nItems; i++) { RefSubRecord ref = getRef(i); if (ref.getExtBookIndex() != externalBookIndex) { continue; } if (ref.getFirstSheetIndex() == firstSheetIndex && ref.getLastSheetIndex() == lastSheetIndex) { return i; } } return -1; }
public void removeSheet(int sheetIdx) { int nItems = _list.size(); for (int i = 0; i < nItems; i++) { RefSubRecord refSubRecord = _list.get(i); if(refSubRecord.getFirstSheetIndex() == sheetIdx && refSubRecord.getLastSheetIndex() == sheetIdx) { // removing the entry would mess up the sheet index in Formula of NameRecord _list.set(i, new RefSubRecord(refSubRecord.getExtBookIndex(), -1, -1)); } else if (refSubRecord.getFirstSheetIndex() > sheetIdx && refSubRecord.getLastSheetIndex() > sheetIdx) { _list.set(i, new RefSubRecord(refSubRecord.getExtBookIndex(), refSubRecord.getFirstSheetIndex()-1, refSubRecord.getLastSheetIndex()-1)); } } }
/** * Returns the last sheet that the reference applies to, or * -1 if the referenced sheet can't be found, or -2 if the * reference is workbook scoped. * For a single sheet reference, the first and last should be * the same. * * @param extRefIndex external sheet reference index * * @return the last sheet that the reference applies to, or * -1 if the referenced sheet can't be found, or -2 if the * reference is workbook scoped. */ public int getLastSheetIndexFromRefIndex(int extRefIndex) { return getRef(extRefIndex).getLastSheetIndex(); }
public int getRefIxForSheet(int externalBookIndex, int firstSheetIndex, int lastSheetIndex) { int nItems = _list.size(); for (int i = 0; i < nItems; i++) { RefSubRecord ref = getRef(i); if (ref.getExtBookIndex() != externalBookIndex) { continue; } if (ref.getFirstSheetIndex() == firstSheetIndex && ref.getLastSheetIndex() == lastSheetIndex) { return i; } } return -1; }
public int getRefIxForSheet(int externalBookIndex, int sheetIndex) { int nItems = _list.size(); for (int i = 0; i < nItems; i++) { RefSubRecord ref = getRef(i); if (ref.getExtBookIndex() != externalBookIndex) { continue; } if (ref.getFirstSheetIndex() == sheetIndex && ref.getLastSheetIndex() == sheetIndex) { return i; } } return -1; }
public int getRefIxForSheet(int externalBookIndex, int sheetIndex) { int nItems = _list.size(); for (int i = 0; i < nItems; i++) { RefSubRecord ref = getRef(i); if (ref.getExtBookIndex() != externalBookIndex) { continue; } if (ref.getFirstSheetIndex() == sheetIndex && ref.getLastSheetIndex() == sheetIndex) { return i; } } return -1; }
/** * Returns the last sheet that the reference applies to, or * -1 if the referenced sheet can't be found, or -2 if the * reference is workbook scoped. * For a single sheet reference, the first and last should be * the same. * * @param extRefIndex external sheet reference index * * @return the last sheet that the reference applies to, or * -1 if the referenced sheet can't be found, or -2 if the * reference is workbook scoped. */ public int getLastSheetIndexFromRefIndex(int extRefIndex) { return getRef(extRefIndex).getLastSheetIndex(); }