List of usage examples for org.apache.poi.ss.usermodel CellStyle setDataFormat
void setDataFormat(short fmt);
From source file:com.validation.manager.core.tool.requirement.importer.RequirementImporter.java
License:Apache License
public static File exportTemplate() throws FileNotFoundException, IOException, InvalidFormatException { File template = new File("Template.xls"); template.createNewFile();//from www . ja va 2 s . c o m org.apache.poi.ss.usermodel.Workbook wb = new HSSFWorkbook(); org.apache.poi.ss.usermodel.Sheet sheet = wb.createSheet(); wb.setSheetName(0, "Requirements"); int column = 0; CellStyle cs = wb.createCellStyle(); cs.setDataFormat(getBuiltinFormat("text")); Font f = wb.createFont(); f.setFontHeightInPoints((short) 12); f.setBold(true); f.setColor((short) Font.COLOR_NORMAL); cs.setFont(f); Row newRow = sheet.createRow(0); for (String label : COLUMNS) { Cell newCell = newRow.createCell(column); newCell.setCellStyle(cs); newCell.setCellValue(label); column++; } try (FileOutputStream out = new FileOutputStream(template)) { wb.write(out); out.close(); } catch (FileNotFoundException e) { LOG.log(Level.SEVERE, null, e); } catch (IOException e) { LOG.log(Level.SEVERE, null, e); } return template; }
From source file:com.validation.manager.core.tool.step.importer.StepImporter.java
License:Apache License
public static File exportTemplate() throws FileNotFoundException, IOException, InvalidFormatException { File template = new File("Template.xls"); template.createNewFile();//from ww w . j a v a2 s.c om org.apache.poi.ss.usermodel.Workbook wb = new HSSFWorkbook(); org.apache.poi.ss.usermodel.Sheet sheet = wb.createSheet(); wb.setSheetName(0, "Steps"); int column = 0; CellStyle cs = wb.createCellStyle(); cs.setDataFormat(getBuiltinFormat("text")); Font f = wb.createFont(); f.setFontHeightInPoints((short) 12); f.setBold(true); f.setColor((short) Font.COLOR_NORMAL); cs.setFont(f); Row newRow = sheet.createRow(0); for (String label : COLUMNS) { Cell newCell = newRow.createCell(column); newCell.setCellStyle(cs); newCell.setCellValue(label); column++; } try (FileOutputStream out = new FileOutputStream(template)) { wb.write(out); out.close(); } catch (FileNotFoundException e) { LOG.log(Level.SEVERE, null, e); } catch (IOException e) { LOG.log(Level.SEVERE, null, e); } return template; }
From source file:com.wabacus.system.assistant.StandardExcelAssistant.java
License:Open Source License
public boolean setCellValue(Workbook workbook, String align, Cell cell, Object objValue, IDataType typeObj, CellStyle cellStyleWithFormat) { if (objValue == null) { cell.setCellValue(""); return false; }/* ww w .j ava 2s. co m*/ if (typeObj instanceof VarcharType) { cell.setCellValue((String) objValue); } else if (typeObj instanceof DoubleType) { cell.setCellValue((Double) objValue); } else if (typeObj instanceof FloatType) { cell.setCellValue((Float) objValue); } else if (typeObj instanceof IntType) { cell.setCellValue((Integer) objValue); } else if (typeObj instanceof LongType) { cell.setCellValue(((Long) objValue)); } else if (typeObj instanceof ShortType) { cell.setCellValue(((Short) objValue)); } else if (typeObj instanceof BigdecimalType) { cell.setCellValue((((BigDecimal) objValue)).doubleValue()); } else if (typeObj instanceof DateType || typeObj instanceof TimeType || typeObj instanceof TimestampType) { cellStyleWithFormat.setDataFormat( workbook.createDataFormat().getFormat(((AbsDateTimeType) typeObj).getDateformat())); if (align != null && !align.trim().equals("")) { cellStyleWithFormat = this.setCellAlign(cellStyleWithFormat, align); } cell.setCellValue(((Date) objValue)); cell.setCellStyle(cellStyleWithFormat); return true; } else if (typeObj instanceof CDateType || typeObj instanceof CTimeType || typeObj instanceof CTimestampType) { cellStyleWithFormat.setDataFormat( workbook.createDataFormat().getFormat(((AbsDateTimeType) typeObj).getDateformat())); if (align != null && !align.trim().equals("")) { cellStyleWithFormat = this.setCellAlign(cellStyleWithFormat, align); } cell.setCellValue(((Calendar) objValue)); cell.setCellStyle(cellStyleWithFormat); return true; } else {//??Excel cell.setCellValue(typeObj.value2label(objValue)); } return false; }
From source file:com.wantdo.stat.excel.poi_src.ConditionalFormats.java
License:Apache License
/** * Use Excel conditional formatting to highlight payments that are due in the next thirty days. * In this example, Due dates are entered in cells A2:A4. *//*www. j av a 2s.c o m*/ static void expiry(Sheet sheet) { CellStyle style = sheet.getWorkbook().createCellStyle(); style.setDataFormat((short) BuiltinFormats.getBuiltinFormat("d-mmm")); sheet.createRow(0).createCell(0).setCellValue("Date"); sheet.createRow(1).createCell(0).setCellFormula("TODAY()+29"); sheet.createRow(2).createCell(0).setCellFormula("A2+1"); sheet.createRow(3).createCell(0).setCellFormula("A3+1"); for (int rownum = 1; rownum <= 3; rownum++) sheet.getRow(rownum).getCell(0).setCellStyle(style); SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting(); // Condition 1: Formula Is =A2=A1 (White Font) ConditionalFormattingRule rule1 = sheetCF .createConditionalFormattingRule("AND(A2-TODAY()>=0,A2-TODAY()<=30)"); FontFormatting font = rule1.createFontFormatting(); font.setFontStyle(false, true); font.setFontColorIndex(IndexedColors.BLUE.index); CellRangeAddress[] regions = { CellRangeAddress.valueOf("A2:A4") }; sheetCF.addConditionalFormatting(regions, rule1); sheet.getRow(0).createCell(1).setCellValue("Dates within the next 30 days are highlighted"); }
From source file:com.wantdo.stat.excel.poi_src.SSPerformanceTest.java
License:Apache License
static Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style; Font headerFont = wb.createFont(); headerFont.setFontHeightInPoints((short) 14); headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD); style = wb.createCellStyle();/* w ww . ja v a2 s . c om*/ style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(headerFont); style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); styles.put("header", style); Font monthFont = wb.createFont(); monthFont.setFontHeightInPoints((short) 12); monthFont.setColor(IndexedColors.RED.getIndex()); monthFont.setBoldweight(Font.BOLDWEIGHT_BOLD); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFillForegroundColor(IndexedColors.YELLOW.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFont(monthFont); styles.put("red-bold", style); String[] nfmt = { "#,##0.00", "$#,##0.00", "m/d/yyyy" }; for (String fmt : nfmt) { style = wb.createCellStyle(); style.setDataFormat(wb.createDataFormat().getFormat(fmt)); styles.put(fmt, style); } return styles; }
From source file:com.webbfontaine.valuewebb.report.utils.cellStyles.CellStyleUtils.java
License:Open Source License
public static CellStyle cellStyle(Workbook workBook, CellType cellType) { CellStyle cellStyle = workBook.createCellStyle(); if (!Color.NO_COLOR.equals(cellType.getColor())) { Font font = workBook.createFont(); font.setFontName("Arial"); font.setColor(cellType.getColor().index()); cellStyle.setFont(font);//from ww w. ja v a 2 s . com } if (!Alignment.NO_ALIGNMENT.equals(cellType.getHorizontalAlignment())) { cellStyle.setAlignment(cellType.getHorizontalAlignment().index()); } if (!Alignment.NO_ALIGNMENT.equals(cellType.getVerticalAlignment())) { cellStyle.setVerticalAlignment(cellType.getVerticalAlignment().index()); } if (!Format.NO_FORMAT.equals(cellType.getFormat())) { CreationHelper creationHelper = workBook.getCreationHelper(); cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat(cellType.getFormat().text())); } setCellBorders(cellStyle); return cellStyle; }
From source file:com.yyl.common.utils.excel.ExcelTools.java
/** * ?ApachePOIAPI??Excel???List?ListJson??LinkedExcel??? * @param inputStream ?urlurlinput?//from w ww.j a va 2s . c o m * @param FileName ???????excel * @return Map HashMapExcelsheet?sheetkeysheet?json?value * @throws IOException */ public static Map<String, String> excel2jsonWithHeaders(InputStream inputStream, String FileName) throws IOException { System.out.println("excel2json...."); // map Map<String, String> excelMap = new LinkedHashMap<>(); // Excel??Excel CellStyle cellStyle; // ?Excel? Workbook wb; // 2007??Workbook?CellStyle if (FileName.endsWith("xlsx")) { System.out.println("2007? xlsx"); wb = new XSSFWorkbook(inputStream); XSSFDataFormat dataFormat = (XSSFDataFormat) wb.createDataFormat(); cellStyle = wb.createCellStyle(); // Excel? cellStyle.setDataFormat(dataFormat.getFormat("@")); } else { System.out.println("2007 xls"); POIFSFileSystem fs = new POIFSFileSystem(inputStream); wb = new HSSFWorkbook(fs); HSSFDataFormat dataFormat = (HSSFDataFormat) wb.createDataFormat(); cellStyle = wb.createCellStyle(); // Excel? cellStyle.setDataFormat(dataFormat.getFormat("@")); } // sheet int sheetsCounts = wb.getNumberOfSheets(); // ???sheet for (int i = 0; i < sheetsCounts; i++) { Sheet sheet = wb.getSheetAt(i); System.out.println("" + i + "sheet:" + sheet.toString()); // sheetList List list = new LinkedList(); // jsonkey String[] cellNames; // ?key Row fisrtRow = sheet.getRow(0); // sheet if (null == fisrtRow) { continue; } // int curCellNum = fisrtRow.getLastCellNum(); System.out.println("" + curCellNum); // ??? cellNames = new String[curCellNum]; // ????JSONkey for (int m = 0; m < curCellNum; m++) { Cell cell = fisrtRow.getCell(m); // ? cell.setCellStyle(cellStyle); cell.setCellType(Cell.CELL_TYPE_STRING); // ? cellNames[m] = getCellValue(cell); } for (String s : cellNames) { System.out.print("" + i + " sheet " + s + ","); } System.out.println(); // ??? int rowNum = sheet.getLastRowNum(); System.out.println(" " + rowNum + " "); for (int j = 1; j < rowNum; j++) { // ?Map LinkedHashMap rowMap = new LinkedHashMap(); // ?? Row row = sheet.getRow(j); int cellNum = row.getLastCellNum(); // ??? for (int k = 0; k < cellNum; k++) { Cell cell = row.getCell(k); cell.setCellStyle(cellStyle); cell.setCellType(Cell.CELL_TYPE_STRING); // ??? rowMap.put(cellNames[k], getCellValue(cell)); } // ??List list.add(rowMap); } // sheet??keyListjson?Value excelMap.put(sheet.getSheetName(), JacksonUtil.bean2Json(list)); } System.out.println("excel2json?...."); return excelMap; }
From source file:com.yyl.common.utils.excel.ExcelTools.java
/** * ?ApachePOIAPI??Excel???List?ListJson??LinkedExcel??? * @param inputStream ?urlurlinput?/*from w ww . j av a 2 s . c o m*/ * @param FileName ???????excel * @param headers list,String-->Arrays.asList(); * @return Map HashMapExcelsheet?sheetkeysheet?json?value * @throws IOException */ public static Map<String, String> excel2json(InputStream inputStream, String fileName, List<String> headers) throws IOException { System.out.println("excel2json...."); // map Map<String, String> excelMap = new LinkedHashMap<>(); // Excel??Excel CellStyle cellStyle; // ?Excel? Workbook wb; // 2007??Workbook?CellStyle if (fileName.endsWith("xlsx")) { System.out.println("2007? xlsx"); wb = new XSSFWorkbook(inputStream); XSSFDataFormat dataFormat = (XSSFDataFormat) wb.createDataFormat(); cellStyle = wb.createCellStyle(); // Excel? cellStyle.setDataFormat(dataFormat.getFormat("@")); } else { System.out.println("2007 xls"); POIFSFileSystem fs = new POIFSFileSystem(inputStream); wb = new HSSFWorkbook(fs); HSSFDataFormat dataFormat = (HSSFDataFormat) wb.createDataFormat(); cellStyle = wb.createCellStyle(); // Excel? cellStyle.setDataFormat(dataFormat.getFormat("@")); } // sheet int sheetsCounts = wb.getNumberOfSheets(); // ???sheet for (int i = 0; i < sheetsCounts; i++) { Sheet sheet = wb.getSheetAt(i); System.out.println("" + i + "sheet:" + sheet.toString()); // sheetList List list = new LinkedList(); // ?key Row fisrtRow = sheet.getRow(0); // sheet if (null == fisrtRow) { continue; } // int curCellNum = fisrtRow.getLastCellNum(); System.out.println("" + curCellNum); // ??? int rowNum = sheet.getLastRowNum(); System.out.println(" " + rowNum + " "); for (int j = 1; j < rowNum; j++) { // ?Map LinkedHashMap rowMap = new LinkedHashMap(); // ?? Row row = sheet.getRow(j); int cellNum = row.getLastCellNum(); // ??? for (int k = 0; k < cellNum; k++) { Cell cell = row.getCell(k); // ??? rowMap.put(headers.get(k), getCellValue(cell)); } // ??List list.add(rowMap); } // sheet??keyListjson?Value excelMap.put(sheet.getSheetName(), JacksonUtil.bean2Json(list)); } System.out.println("excel2json?...."); return excelMap; }
From source file:Compras.generaCotizacion.java
void exel() { h = new Herramientas(this.user, 0); h.session(sessionPrograma);//from www. ja v a2s. com javax.swing.JFileChooser jF1 = new javax.swing.JFileChooser(); jF1.setFileFilter(new ExtensionFileFilter("Excel document (*.xls)", new String[] { "xls" })); String ruta = null; if (jF1.showSaveDialog(null) == jF1.APPROVE_OPTION) { ruta = jF1.getSelectedFile().getAbsolutePath(); if (ruta != null) { if (ruta.endsWith(".xls") == true) archivoXLS = new File(ruta); else archivoXLS = new File(ruta + ".xls"); try { if (archivoXLS.exists()) archivoXLS.delete(); archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("Cotizacion"); Font font = libro.createFont(); font.setFontHeightInPoints((short) 24); font.setFontName("Arial"); font.setItalic(false); font.setBold(true); Font font10 = libro.createFont(); font10.setFontHeightInPoints((short) 10); font10.setFontName("Arial"); font10.setItalic(false); font10.setBold(false); font10.setColor(new HSSFColor.YELLOW().getIndex()); Font font11 = libro.createFont(); font11.setFontHeightInPoints((short) 10); font11.setFontName("Arial"); font10.setItalic(false); font10.setBold(false); font11.setColor(new HSSFColor.BLACK().getIndex()); // Fonts are set into a style so create a new one to use. CellStyle style = libro.createCellStyle(); CellStyle desBloqueo = libro.createCellStyle(); CellStyle desBloqueo1 = libro.createCellStyle(); CellStyle desBloqueoFecha = libro.createCellStyle(); style.setFont(font); desBloqueo.setFont(font10); desBloqueo.setLocked(false); desBloqueo.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); desBloqueo.setFillBackgroundColor(new HSSFColor.GREEN().getIndex()); desBloqueo1.setFont(font11); desBloqueo1.setLocked(false); desBloqueo1.setFillBackgroundColor(new HSSFColor.WHITE().getIndex()); desBloqueoFecha.setFont(font10); desBloqueoFecha.setLocked(false); desBloqueoFecha.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); desBloqueoFecha.setFillBackgroundColor(new HSSFColor.GREEN().getIndex()); desBloqueoFecha.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy")); Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction().begin(); Orden ord = (Orden) session.get(Orden.class, Integer.parseInt(orden)); Configuracion con = (Configuracion) session.get(Configuracion.class, 1); hoja.setColumnWidth(5, 15000); Row r0 = hoja.createRow(0); Cell celdaTitulo = r0.createCell(0); celdaTitulo.setCellValue(con.getEmpresa()); celdaTitulo.setCellStyle(style); Row r1 = hoja.createRow(1); r1.createCell(6).setCellValue("Orden de Taller:"); r1.createCell(7).setCellValue(orden); Row r2 = hoja.createRow(2); r2.createCell(0).setCellValue("Marca:"); r2.createCell(1).setCellValue(ord.getMarca().getMarcaNombre()); r2.createCell(6).setCellValue("N Serie:"); r2.createCell(7).setCellValue(ord.getNoSerie()); Row r3 = hoja.createRow(3); r3.createCell(0).setCellValue("Tipo:"); r3.createCell(1).setCellValue(ord.getTipo().getTipoNombre()); r3.createCell(6).setCellValue("N Motor:"); r3.createCell(7).setCellValue(ord.getNoMotor()); Row r4 = hoja.createRow(4); r4.createCell(0).setCellValue("NP:"); r4.createCell(1).setCellValue(t_datos1.getValueAt(t_datos1.getSelectedRow(), 1).toString()); r4.createCell(2).setCellValue("Proveedor:"); r4.createCell(3).setCellValue(t_datos1.getValueAt(t_datos1.getSelectedRow(), 2).toString()); r4.createCell(6).setCellValue("Modelo:"); r4.createCell(7).setCellValue("" + ord.getModelo()); Row r5 = hoja.createRow(5); r5.createCell(0).setCellValue( "**********************************************************************************[Nota: Solo puedes editar las celdas de color]*******************************************************************************"); Row r6 = hoja.createRow(6); r6.createCell(0).setCellValue("Partida"); r6.createCell(1).setCellValue("sub"); r6.createCell(2).setCellValue("Cantidad"); r6.createCell(3).setCellValue("U/Medida"); r6.createCell(4).setCellValue("N Parte"); r6.createCell(5).setCellValue("Descripcion"); r6.createCell(6).setCellValue("Instruccin"); r6.createCell(7).setCellValue("Precio c/u"); r6.createCell(8).setCellValue("T o t a l"); r6.createCell(9).setCellValue("Origen"); r6.createCell(10).setCellValue("Pazo"); Row r7 = hoja.createRow(7); r7.createCell(0).setCellValue( "**********************************************************************************************************************************************************************************************************************"); List misCotizaciones = null; Query query = session.createQuery("SELECT DISTINCT par FROM Partida par " + "RIGHT JOIN FETCH par.partidaCotizacions partC " + "RIGHT JOIN partC.cotizacion cot " + "where cot.idCotizacion=" + t_datos1.getValueAt(t_datos1.getSelectedRow(), 0).toString() + " order by par.idEvaluacion asc, par.subPartida asc"); //misCotizaciones=c.addOrder(Order.asc("idCotizacion")).list(); misCotizaciones = query.list(); if (misCotizaciones.size() > 0) { for (int i = 0; i < misCotizaciones.size(); i++) { Partida Part = (Partida) misCotizaciones.get(i); Row fila = hoja.createRow(i + 8); fila.createCell(0).setCellValue(Part.getIdEvaluacion()); fila.createCell(1).setCellValue(Part.getSubPartida()); fila.createCell(2).setCellValue(Part.getCant()); fila.createCell(3).setCellValue(Part.getMed()); Cell aux = fila.createCell(4); aux.setCellStyle(desBloqueo); if (Part.getEjemplar() != null) aux.setCellValue(Part.getEjemplar().getIdParte()); else aux.setCellValue(""); fila.createCell(5).setCellValue(Part.getCatalogo().getNombre()); int fil = i + 9; Cell a10 = fila.createCell(6); a10.setCellStyle(desBloqueo1); a10.setCellValue(Part.getInstruccion()); Cell a6 = fila.createCell(7); a6.setCellStyle(desBloqueo); a6.setCellValue(""); Cell celForm = fila.createCell(8); celForm.setCellType(HSSFCell.CELL_TYPE_FORMULA); celForm.setCellFormula("H" + fil + "*C" + fil); if (Part.isOri() == true) fila.createCell(9).setCellValue("Ori"); else if (Part.isNal() == true) fila.createCell(9).setCellValue("Nal"); else if (Part.isDesm() == true) fila.createCell(9).setCellValue("Des"); else fila.createCell(9).setCellValue(""); Cell a9 = fila.createCell(10); a9.setCellValue(""); a9.setCellStyle(desBloqueo); } } hoja.protectSheet("04650077"); libro.write(archivo); archivo.close(); Desktop.getDesktop().open(archivoXLS); if (session != null) if (session.isOpen()) session.close(); } catch (Exception e) { System.out.println(e); e.printStackTrace(); JOptionPane.showMessageDialog(this, "No se pudo realizar el reporte si el archivo esta abierto"); } } } }
From source file:controller.DAORequest.java
public void saveRequest() { XSSFSheet sheet = workbook.getSheetAt(0); sheet.getRow(0).createCell(10).setCellValue("Id solicitante"); sheet.getRow(0).createCell(11).setCellValue("Nombre solicitante"); sheet.getRow(0).createCell(12).setCellValue("Estado de solicitud"); sheet.getRow(0).createCell(13).setCellValue("Num de Resolucion"); int rowI = 1; for (Object o : School.getInstance().selectAllRequests()) { Request r = (Request) o; Row row = sheet.createRow(rowI); ////from w w w . j a v a2s . c om Cell cellDate = row.createCell(0); cellDate.setCellValue(r.getDate()); CellStyle styleCreationDate = workbook.createCellStyle(); XSSFDataFormat dfCreationDate = workbook.createDataFormat(); styleCreationDate.setDataFormat(dfCreationDate.getFormat("d/m/yy")); cellDate.setCellStyle(styleCreationDate); // Cell cellCarnet = row.createCell(1); cellCarnet.setCellValue(r.getAffected().getId()); CellStyle styleCreationInt = workbook.createCellStyle(); XSSFDataFormat dfCreationInt = workbook.createDataFormat(); Cell cellName = row.createCell(2); cellName.setCellValue(r.getAffected().getName()); Cell cellEmail = row.createCell(3); cellEmail.setCellValue(r.getAffected().getEmail()); Cell cellPhone = row.createCell(4); cellPhone.setCellValue(r.getAffected().getPhone()); Cell cellPeriod = row.createCell(5); cellPeriod.setCellValue(r.getGroup().getPeriod()); Cell cellCourse = row.createCell(6); cellCourse.setCellValue(r.getGroup().getCourse().getCode()); Cell cellNumGroup = row.createCell(7); cellNumGroup.setCellType(Cell.CELL_TYPE_NUMERIC); cellNumGroup.setCellValue(r.getGroup().getNumber()); Cell cellInc = row.createCell(8); cellInc.setCellValue(transformInconsistencieToSpanish(r.getInconsistencie())); Cell cellDescription = row.createCell(9); cellDescription.setCellValue(r.getDescription()); Cell cellIdReq = row.createCell(10); cellIdReq.setCellValue(r.getRequester().getId()); Cell cellNameReq = row.createCell(11); cellNameReq.setCellValue(r.getRequester().getName()); Cell cellReqState = row.createCell(12); cellReqState.setCellValue(transformReqStatetoSpanish(r.getRequestState())); if (r.getRequestState() == ERequestState.PROCESSED) { Cell cellNumReso = row.createCell(13); cellNumReso.setCellValue(Integer.toString(r.getResolution().getId())); } rowI++; } // Save to excel file try { FileOutputStream out = new FileOutputStream(new File("src//files//DatosFormulario.xlsx")); workbook.write(out); workbook.close(); out.close(); saveResolution(); } catch (FileNotFoundException ex) { Logger.getLogger(DAORequest.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(DAORequest.class.getName()).log(Level.SEVERE, null, ex); } }