protected Workbook getTemplateSource(String url, HttpServletRequest request) throws Exception { LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext()); Locale userLocale = RequestContextUtils.getLocale(request); Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale); // Create the Excel document from the source. if (logger.isDebugEnabled()) { logger.debug("Loading Excel workbook from " + inputFile); } //POIFSFileSystem fs = new POIFSFileSystem(inputFile.getInputStream()); return new XSSFWorkbook(inputFile.getInputStream()); }
/** * Create the workbook from an existing XLS document. * @param url the URL of the Excel template without localization part nor extension * @param request current HTTP request * @return the template workbook * @throws Exception in case of failure */ protected Workbook getTemplateSource(String url, HttpServletRequest request) throws Exception { LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext()); Locale userLocale = RequestContextUtils.getLocale(request); Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale); // Create the Excel document from the source. if (logger.isDebugEnabled()) { logger.debug("Loading Excel workbook from " + inputFile); } return Workbook.getWorkbook(inputFile.getInputStream()); }
/** * Creates the workbook from an existing XLS document. * @param url the URL of the Excel template without localization part nor extension * @param request current HTTP request * @return the HSSFWorkbook * @throws Exception in case of failure */ protected HSSFWorkbook getTemplateSource(String url, HttpServletRequest request) throws Exception { LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext()); Locale userLocale = RequestContextUtils.getLocale(request); Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale); // Create the Excel document from the source. if (logger.isDebugEnabled()) { logger.debug("Loading Excel workbook from " + inputFile); } return new HSSFWorkbook(inputFile.getInputStream()); }
/** * Creates the workbook from an existing XLS document. * @param url the URL of the Excel template without localization part nor extension * @param request current HTTP request * @return the HSSFWorkbook * @throws Exception in case of failure */ protected HSSFWorkbook getTemplateSource(String url, HttpServletRequest request) throws Exception { LocalizedResourceHelper helper = new LocalizedResourceHelper(getApplicationContext()); Locale userLocale = RequestContextUtils.getLocale(request); Resource inputFile = helper.findLocalizedResource(url, EXTENSION, userLocale); // Create the Excel document from the source. if (logger.isDebugEnabled()) { logger.debug("Loading Excel workbook from " + inputFile); } POIFSFileSystem fs = new POIFSFileSystem(inputFile.getInputStream()); return new HSSFWorkbook(fs); }