/** * Interface method from WorkbookMethods - gets the specified * sheet within this workbook * * @param index the zero based index of the required sheet * @return The sheet specified by the index */ public Sheet getReadSheet(int index) { return getSheet(index); }
/** * Interface method from WorkbookMethods - gets the specified * sheet within this workbook * * @param index the zero based index of the required sheet * @return The sheet specified by the index */ public Sheet getReadSheet(int index) { return getSheet(index); }
/** * Gets the sheet names * * @return an array of strings containing the sheet names */ public String[] getSheetNames() { String[] sheetNames = new String[getNumberOfSheets()]; for (int i = 0 ; i < sheetNames.length ; i++) { sheetNames[i] = getSheet(i).getName(); } return sheetNames; }
/** * Copies the specified sheet and places it at the index * specified by the parameter * * @param s the index of the sheet to copy * @param name the name of the new sheet * @param index the position of the new sheet */ public void copySheet(int s, String name, int index) { WritableSheet sheet = getSheet(s); WritableSheetImpl ws = (WritableSheetImpl) createSheet(name, index); ws.copy(sheet); }
/** * Returns the cell for the specified location eg. "Sheet1!A4". * This is identical to using the CellReferenceHelper with its * associated performance overheads, consequently it should * be use sparingly * * @param loc the cell to retrieve * @return the cell at the specified location */ public WritableCell getWritableCell(String loc) { WritableSheet s = getSheet(CellReferenceHelper.getSheet(loc)); return s.getWritableCell(loc); }
/** * Returns the cell for the specified location eg. "Sheet1!A4". * This is identical to using the CellReferenceHelper with its * associated performance overheads, consequently it should * be use sparingly * * @param loc the cell to retrieve * @return the cell at the specified location */ public WritableCell getWritableCell(String loc) { WritableSheet s = getSheet(CellReferenceHelper.getSheet(loc)); return s.getWritableCell(loc); }
/** * Copies the specified sheet and places it at the index * specified by the parameter * * @param s the name of the sheet to copy * @param name the name of the new sheet * @param index the position of the new sheet */ public void copySheet(String s, String name, int index) { WritableSheet sheet = getSheet(s); WritableSheetImpl ws = (WritableSheetImpl) createSheet(name, index); ws.copy(sheet); }
/** * Gets the sheet names * * @return an array of strings containing the sheet names */ public String[] getSheetNames() { String[] sheetNames = new String[getNumberOfSheets()]; for (int i = 0 ; i < sheetNames.length ; i++) { sheetNames[i] = getSheet(i).getName(); } return sheetNames; }
/** * Copies the specified sheet and places it at the index * specified by the parameter * * @param s the index of the sheet to copy * @param name the name of the new sheet * @param index the position of the new sheet */ public void copySheet(int s, String name, int index) { WritableSheet sheet = getSheet(s); WritableSheetImpl ws = (WritableSheetImpl) createSheet(name, index); ws.copy(sheet); }
/** * Copies the specified sheet and places it at the index * specified by the parameter * * @param s the name of the sheet to copy * @param name the name of the new sheet * @param index the position of the new sheet */ public void copySheet(String s, String name, int index) { WritableSheet sheet = getSheet(s); WritableSheetImpl ws = (WritableSheetImpl) createSheet(name, index); ws.copy(sheet); }
/** * Gets the sheets within this workbook. Use of this method for * large worksheets can cause performance problems. * * @return an array of the individual sheets */ public WritableSheet[] getSheets() { WritableSheet[] sheetArray = new WritableSheet[getNumberOfSheets()]; for (int i = 0 ; i < getNumberOfSheets() ; i++) { sheetArray[i] = getSheet(i); } return sheetArray; }
/** * Gets the sheets within this workbook. Use of this method for * large worksheets can cause performance problems. * * @return an array of the individual sheets */ public WritableSheet[] getSheets() { WritableSheet[] sheetArray = new WritableSheet[getNumberOfSheets()]; for (int i = 0 ; i < getNumberOfSheets() ; i++) { sheetArray[i] = getSheet(i); } return sheetArray; }
/** * Gets the named cell from this workbook. If the name refers to a * range of cells, then the cell on the top left is returned. If * the name cannot be found, null is returned * * @param the name of the cell/range to search for * @return the cell in the top left of the range if found, NULL * otherwise */ public WritableCell findCellByName(String name) { NameRecord nr = (NameRecord) nameRecords.get(name); if (nr == null) { return null; } NameRecord.NameRange[] ranges = nr.getRanges(); // Go and retrieve the first cell in the first range int sheetIndex = getExternalSheetIndex(ranges[0].getExternalSheet()); WritableSheet s = getSheet(sheetIndex); WritableCell cell = s.getWritableCell(ranges[0].getFirstColumn(), ranges[0].getFirstRow()); return cell; }
/** * Gets the named cell from this workbook. If the name refers to a * range of cells, then the cell on the top left is returned. If * the name cannot be found, null is returned * * @param the name of the cell/range to search for * @return the cell in the top left of the range if found, NULL * otherwise */ public WritableCell findCellByName(String name) { NameRecord nr = (NameRecord) nameRecords.get(name); if (nr == null) { return null; } NameRecord.NameRange[] ranges = nr.getRanges(); // Go and retrieve the first cell in the first range int sheetIndex = getExternalSheetIndex(ranges[0].getExternalSheet()); WritableSheet s = getSheet(sheetIndex); WritableCell cell = s.getWritableCell(ranges[0].getFirstColumn(), ranges[0].getFirstRow()); return cell; }
/** * Gets the name of the last external sheet specified by the index * * @param index the external sheet index * @return the name of the external sheet */ public String getLastExternalSheetName(int index) { int supbookIndex = externSheet.getSupbookIndex(index); SupbookRecord sr = (SupbookRecord) supbooks.get(supbookIndex); int lastTab = externSheet.getLastTabIndex(index); if (sr.getType() == SupbookRecord.INTERNAL) { // It's an internal reference - get the name from the sheets list WritableSheet ws = getSheet(lastTab); return ws.getName(); } else if (sr.getType() == SupbookRecord.EXTERNAL) { Assert.verify(false); } // An unknown supbook - return unkown logger.warn("Unknown Supbook 2"); return "[UNKNOWN]"; }
/** * Gets the name of the last external sheet specified by the index * * @param index the external sheet index * @return the name of the external sheet */ public String getLastExternalSheetName(int index) { int supbookIndex = externSheet.getSupbookIndex(index); SupbookRecord sr = (SupbookRecord) supbooks.get(supbookIndex); int lastTab = externSheet.getLastTabIndex(index); if (sr.getType() == SupbookRecord.INTERNAL) { // It's an internal reference - get the name from the sheets list WritableSheet ws = getSheet(lastTab); return ws.getName(); } else if (sr.getType() == SupbookRecord.EXTERNAL) { Assert.verify(false); } // An unknown supbook - return unkown logger.warn("Unknown Supbook 2"); return "[UNKNOWN]"; }
/** * Gets the name of the external sheet specified by the index * * @param index the external sheet index * @return the name of the external sheet */ public String getExternalSheetName(int index) { int supbookIndex = externSheet.getSupbookIndex(index); SupbookRecord sr = (SupbookRecord) supbooks.get(supbookIndex); int firstTab = externSheet.getFirstTabIndex(index); if (sr.getType() == SupbookRecord.INTERNAL) { // It's an internal reference - get the name from the sheets list WritableSheet ws = getSheet(firstTab); return ws.getName(); } else if (sr.getType() == SupbookRecord.EXTERNAL) { String name = sr.getFileName() + sr.getSheetName(firstTab); return name; } // An unknown supbook - return unkown logger.warn("Unknown Supbook 1"); return "[UNKNOWN]"; }
/** * Gets the name of the external sheet specified by the index * * @param index the external sheet index * @return the name of the external sheet */ public String getExternalSheetName(int index) { int supbookIndex = externSheet.getSupbookIndex(index); SupbookRecord sr = (SupbookRecord) supbooks.get(supbookIndex); int firstTab = externSheet.getFirstTabIndex(index); if (sr.getType() == SupbookRecord.INTERNAL) { // It's an internal reference - get the name from the sheets list WritableSheet ws = getSheet(firstTab); return ws.getName(); } else if (sr.getType() == SupbookRecord.EXTERNAL) { String name = sr.getFileName() + sr.getSheetName(firstTab); return name; } // An unknown supbook - return unkown logger.warn("Unknown Supbook 1"); return "[UNKNOWN]"; }
for (int i = 0; i < getNumberOfSheets(); i++) wsi = (WritableSheetImpl) getSheet(i); for (int i = 0 ; i < getNumberOfSheets() && !sheetSelected ; i++) wsheet = (WritableSheetImpl) getSheet(i); if (wsheet.getSettings().isSelected()) wsheet = (WritableSheetImpl) getSheet(0); wsheet.getSettings().setSelected(true); selectedSheetIndex = 0; sheet = getSheet(i); BoundsheetRecord br = new BoundsheetRecord(sheet.getName()); if (sheet.getSettings().isHidden()) boundsheetPos[i] + 4); wsheet = (WritableSheetImpl) getSheet(i); wsheet.write();
for (int i = 0; i < getNumberOfSheets(); i++) wsi = (WritableSheetImpl) getSheet(i); for (int i = 0 ; i < getNumberOfSheets() && !sheetSelected ; i++) wsheet = (WritableSheetImpl) getSheet(i); if (wsheet.getSettings().isSelected()) wsheet = (WritableSheetImpl) getSheet(0); wsheet.getSettings().setSelected(true); selectedSheetIndex = 0; sheet = getSheet(i); BoundsheetRecord br = new BoundsheetRecord(sheet.getName()); if (sheet.getSettings().isHidden()) boundsheetPos[i] + 4); wsheet = (WritableSheetImpl) getSheet(i); wsheet.write();