/** * Gets the sheet names * * @return an array of strings containing the sheet names */ public String[] getSheetNames() { String[] names = new String[boundsheets.size()]; BoundsheetRecord br = null; for (int i = 0; i < names.length; i++) { br = (BoundsheetRecord) boundsheets.get(i); names[i] = br.getName(); } return names; }
/** * Gets the sheet names * * @return an array of strings containing the sheet names */ public String[] getSheetNames() { String[] names = new String[boundsheets.size()]; BoundsheetRecord br = null; for (int i = 0; i < names.length; i++) { br = (BoundsheetRecord) boundsheets.get(i); names[i] = br.getName(); } return names; }
/** * Gets the sheet index in this workbook. Used when importing a sheet * * @param sheet the sheet * @return the 0-based sheet index, or -1 if it is not found */ public int getIndex(Sheet sheet) { String name = sheet.getName(); int index = -1; int pos = 0; for (Iterator i = boundsheets.iterator() ; i.hasNext() && index == -1 ;) { BoundsheetRecord br = (BoundsheetRecord) i.next(); if (br.getName().equals(name)) { index = pos; } else { pos++; } } return index; }
/** * Gets the sheet index in this workbook. Used when importing a sheet * * @param sheet the sheet * @return the 0-based sheet index, or -1 if it is not found */ public int getIndex(Sheet sheet) { String name = sheet.getName(); int index = -1; int pos = 0; for (Iterator i = boundsheets.iterator() ; i.hasNext() && index == -1 ;) { BoundsheetRecord br = (BoundsheetRecord) i.next(); if (br.getName().equals(name)) { index = pos; } else { pos++; } } return index; }
/** * Gets the sheet with the specified name from within this workbook * * @param name the sheet name * @return The sheet with the specified name, or null if it is not found */ public Sheet getSheet(String name) { // Iterate through the boundsheet records int pos = 0; boolean found = false; Iterator i = boundsheets.iterator(); BoundsheetRecord br = null; while (i.hasNext() && !found) { br = (BoundsheetRecord) i.next(); if (br.getName().equals(name)) { found = true; } else { pos++; } } return found ? getSheet(pos) : null; }
/** * Gets the sheet with the specified name from within this workbook * * @param name the sheet name * @return The sheet with the specified name, or null if it is not found */ public Sheet getSheet(String name) { // Iterate through the boundsheet records int pos = 0; boolean found = false; Iterator i = boundsheets.iterator(); BoundsheetRecord br = null; while (i.hasNext() && !found) { br = (BoundsheetRecord) i.next(); if (br.getName().equals(name)) { found = true; } else { pos++; } } return found ? getSheet(pos) : null; }