/** * 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; }
/** * Constructs this object from the raw data * * @param t the raw data * @param biff7 a dummy value to tell the record to interpret the * data as biff7 */ public BoundsheetRecord(Record t, Biff7 biff7) { super(t); byte[] data = getRecord().getData(); offset = IntegerHelper.getInt(data[0], data[1], data[2], data[3]); typeFlag = data[5]; visibilityFlag = data[4]; length = data[6]; byte[] bytes = new byte[length]; System.arraycopy(data, 7, bytes, 0, length); name = new String(bytes); }
br = new BoundsheetRecord(r, settings); br = new BoundsheetRecord(r, BoundsheetRecord.biff7); if (br.isSheet()) else if (br.isChart() && !settings.getDrawingsDisabled()) s.setName(br.getName()); s.setHidden(br.isHidden()); addSheet(s); s.setName(br.getName()); s.setHidden(br.isHidden()); addSheet(s);
br = new BoundsheetRecord(r, settings); br = new BoundsheetRecord(r, BoundsheetRecord.biff7); if (br.isSheet()) else if (br.isChart() && !settings.getDrawingsDisabled()) s.setName(br.getName()); s.setHidden(br.isHidden()); addSheet(s); s.setName(br.getName()); s.setHidden(br.isHidden()); addSheet(s);
/** * 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; }
/** * Constructs this object from the raw data * * @param t the raw data * @param biff7 a dummy value to tell the record to interpret the * data as biff7 */ public BoundsheetRecord(Record t, Biff7 biff7) { super(t); byte[] data = getRecord().getData(); offset = IntegerHelper.getInt(data[0], data[1], data[2], data[3]); typeFlag = data[5]; visibilityFlag = data[4]; length = data[6]; byte[] bytes = new byte[length]; System.arraycopy(data, 7, bytes, 0, length); name = new String(bytes); }
/** * 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; }
/** * Constructs this object from the raw data * * @param t the raw data * @param s the workbook settings */ public BoundsheetRecord(Record t, WorkbookSettings s) { super(t); byte[] data = getRecord().getData(); offset = IntegerHelper.getInt(data[0], data[1], data[2], data[3]); typeFlag = data[5]; visibilityFlag = data[4]; length = data[6]; if (data[7] == 0) { // Standard ASCII encoding byte[] bytes = new byte[length]; System.arraycopy(data, 8, bytes, 0, length); name = StringHelper.getString(bytes, length, 0, s); } else { // little endian Unicode encoding byte[] bytes = new byte[length * 2]; System.arraycopy(data, 8, bytes, 0, length * 2); name = StringHelper.getUnicodeString(bytes, length, 0); } }
/** * 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; }
/** * Constructs this object from the raw data * * @param t the raw data * @param s the workbook settings */ public BoundsheetRecord(Record t, WorkbookSettings s) { super(t); byte[] data = getRecord().getData(); offset = IntegerHelper.getInt(data[0], data[1], data[2], data[3]); typeFlag = data[5]; visibilityFlag = data[4]; length = data[6]; if (data[7] == 0) { // Standard ASCII encoding byte[] bytes = new byte[length]; System.arraycopy(data, 8, bytes, 0, length); name = StringHelper.getString(bytes, length, 0, s); } else { // little endian Unicode encoding byte[] bytes = new byte[length * 2]; System.arraycopy(data, 8, bytes, 0, length * 2); name = StringHelper.getUnicodeString(bytes, length, 0); } }
/** * 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; }