/** * Returns the name of this sheet * * @return the name of this sheet */ @Override public String getSheetName() { return sheet.getName(); }
/** * Determines whether a workbook contains the provided sheet name. * For the purpose of comparison, long names are truncated to 31 chars. * * @param name the name to test (case insensitive match) * @param excludeSheetIdx the sheet to exclude from the check or -1 to include all sheets in the check. * @return true if the sheet contains the name, false otherwise. */ private boolean containsSheet(String name, int excludeSheetIdx) { //noinspection deprecation CTSheet[] ctSheetArray = workbook.getSheets().getSheetArray(); if (name.length() > MAX_SENSITIVE_SHEET_NAME_LEN) { name = name.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN); } for (int i = 0; i < ctSheetArray.length; i++) { String ctName = ctSheetArray[i].getName(); if (ctName.length() > MAX_SENSITIVE_SHEET_NAME_LEN) { ctName = ctName.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN); } if (excludeSheetIdx != i && name.equalsIgnoreCase(ctName)) { return true; } } return false; }
/** * Not normally to be called externally, but possibly to be overridden to avoid * the DOM based parse of large sheets (see examples). */ public void parseSheet(Map<String, XSSFSheet> shIdMap, CTSheet ctSheet) { XSSFSheet sh = shIdMap.get(ctSheet.getId()); if(sh == null) { logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping"); return; } sh.sheet = ctSheet; sh.onDocumentRead(); sheets.add(sh); }
/** * Returns the name of this sheet * * @return the name of this sheet */ @Override public String getSheetName() { return sheet.getName(); }
/** * Returns the name of this sheet * * @return the name of this sheet */ public String getSheetName() { return sheet.getName(); }
/** * Returns name of the current sheet * * @return name of the current sheet */ public String getSheetName() { return ctSheet.getName(); }
/** * Avoid DOM parse of large sheet */ @Override public void parseSheet(java.util.Map<String, XSSFSheet> shIdMap, CTSheet ctSheet) { if (!SHEET_TO_STREAM.equals(ctSheet.getName())) { super.parseSheet(shIdMap, ctSheet); } } };
/** * Determines whether a workbook contains the provided sheet name. * For the purpose of comparison, long names are truncated to 31 chars. * * @param name the name to test (case insensitive match) * @param excludeSheetIdx the sheet to exclude from the check or -1 to include all sheets in the check. * @return true if the sheet contains the name, false otherwise. */ @SuppressWarnings("deprecation") // getXYZArray() array accessors are deprecated private boolean containsSheet(String name, int excludeSheetIdx) { CTSheet[] ctSheetArray = workbook.getSheets().getSheetArray(); if (name.length() > MAX_SENSITIVE_SHEET_NAME_LEN) { name = name.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN); } for (int i = 0; i < ctSheetArray.length; i++) { String ctName = ctSheetArray[i].getName(); if (ctName.length() > MAX_SENSITIVE_SHEET_NAME_LEN) { ctName = ctName.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN); } if (excludeSheetIdx != i && name.equalsIgnoreCase(ctName)) return true; } return false; }
/** * Determines whether a workbook contains the provided sheet name. * For the purpose of comparison, long names are truncated to 31 chars. * * @param name the name to test (case insensitive match) * @param excludeSheetIdx the sheet to exclude from the check or -1 to include all sheets in the check. * @return true if the sheet contains the name, false otherwise. */ private boolean containsSheet(String name, int excludeSheetIdx) { //noinspection deprecation CTSheet[] ctSheetArray = workbook.getSheets().getSheetArray(); if (name.length() > MAX_SENSITIVE_SHEET_NAME_LEN) { name = name.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN); } for (int i = 0; i < ctSheetArray.length; i++) { String ctName = ctSheetArray[i].getName(); if (ctName.length() > MAX_SENSITIVE_SHEET_NAME_LEN) { ctName = ctName.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN); } if (excludeSheetIdx != i && name.equalsIgnoreCase(ctName)) { return true; } } return false; }
/** * Not normally to be called externally, but possibly to be overridden to avoid * the DOM based parse of large sheets (see examples). */ public void parseSheet(Map<String, XSSFSheet> shIdMap, CTSheet ctSheet) { XSSFSheet sh = shIdMap.get(ctSheet.getId()); if(sh == null) { logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping"); return; } sh.sheet = ctSheet; sh.onDocumentRead(); sheets.add(sh); }
private void translateSheetName(XSSFSheet sheet, XLXContext context) throws Exception { for( CTSheet next : sheet.getWorkbook().getCTWorkbook().getSheets().getSheetArray()){ if(next.getName().equals(sheet.getSheetName())){ String rawName = next.getName(); XLSXExpression exp = CellExpressionParser.parseExpression(next.getName()); String translatedName = (String) exp.evaluate(context); next.setName(translatedName); translateSheetName(sheet, rawName, translatedName); break; } } }
XSSFSheet sh = shIdMap.get(ctSheet.getId()); if(sh == null) { logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping"); continue;