List of usage examples for org.apache.poi.ss.usermodel Sheet autoSizeColumn
void autoSizeColumn(int column);
From source file:com.mycompany.gayamtakehomeexam.WritetoExcel.java
public void writeSongsListToExcel(List<Song> songList) { /*// www . j av a 2s . c o m Use XSSF for xlsx format and for xls use HSSF */ Workbook workbook = new XSSFWorkbook(); /* create new sheet */ Sheet songsSheet = workbook.createSheet("Albums"); XSSFCellStyle my_style = (XSSFCellStyle) workbook.createCellStyle(); /* Create XSSFFont object from the workbook */ XSSFFont my_font = (XSSFFont) workbook.createFont(); /* setting cell color */ CellStyle style = workbook.createCellStyle(); style.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); CellStyle style1 = workbook.createCellStyle();//Create style Font font = workbook.createFont();//Create font font.setBoldweight(Font.BOLDWEIGHT_BOLD);//Make font bold style1.setFont(font);//set it to bold style1.setAlignment(CellStyle.ALIGN_CENTER); CellStyle style13 = workbook.createCellStyle();//Create style Font font13 = workbook.createFont();//Create font style13.setAlignment(CellStyle.ALIGN_LEFT); CellStyle style14 = workbook.createCellStyle();//Create style Font font14 = workbook.createFont();//Create font style14.setAlignment(CellStyle.ALIGN_RIGHT); /* setting Header color */ CellStyle style2 = workbook.createCellStyle(); style2.setFillForegroundColor(IndexedColors.LIGHT_ORANGE.getIndex()); style2.setFillBackgroundColor(IndexedColors.LIGHT_ORANGE.getIndex()); style2.setFillPattern(CellStyle.SOLID_FOREGROUND); Row rowName = songsSheet.createRow(1); /* Merging the cells */ songsSheet.addMergedRegion(new CellRangeAddress(1, 1, 2, 3)); /* Applying style to attribute name */ int nameCellIndex = 1; Cell namecell = rowName.createCell(nameCellIndex++); namecell.setCellValue("Name"); namecell.setCellStyle(style); Cell cel = rowName.createCell(nameCellIndex++); /* Applying underline to Name */ Font underlineFont = workbook.createFont(); underlineFont.setUnderline(HSSFFont.U_SINGLE); /* Attaching the style to the cell */ CellStyle combined = workbook.createCellStyle(); combined.setFont(underlineFont); cel.setCellStyle(combined); cel.setCellValue("Gayam, Prathibha"); /* Applying colors to header */ Row rowMain = songsSheet.createRow(3); SheetConditionalFormatting sheetCF = songsSheet.getSheetConditionalFormatting(); ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule("3"); PatternFormatting fill1 = rule1.createPatternFormatting(); fill1.setFillBackgroundColor(IndexedColors.LIGHT_ORANGE.index); fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND); CellRangeAddress[] regions = { CellRangeAddress.valueOf("A4:G4") }; sheetCF.addConditionalFormatting(regions, rule1); /* setting new rule to apply alternate colors to cells having same Genre */ ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule("4"); PatternFormatting fill2 = rule2.createPatternFormatting(); fill2.setFillBackgroundColor(IndexedColors.LEMON_CHIFFON.index); fill2.setFillPattern(PatternFormatting.SOLID_FOREGROUND); CellRangeAddress[] regionsAction = { CellRangeAddress.valueOf("A5:G5"), CellRangeAddress.valueOf("A6:G6"), CellRangeAddress.valueOf("A7:G7"), CellRangeAddress.valueOf("A8:G8"), CellRangeAddress.valueOf("A13:G13"), CellRangeAddress.valueOf("A14:G14"), CellRangeAddress.valueOf("A15:G15"), CellRangeAddress.valueOf("A16:G16"), CellRangeAddress.valueOf("A23:G23"), CellRangeAddress.valueOf("A24:G24"), CellRangeAddress.valueOf("A25:G25"), CellRangeAddress.valueOf("A26:G26") }; /* setting new rule to apply alternate colors to cells having same Genre */ ConditionalFormattingRule rule3 = sheetCF.createConditionalFormattingRule("4"); PatternFormatting fill3 = rule3.createPatternFormatting(); fill3.setFillBackgroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.index); fill3.setFillPattern(PatternFormatting.SOLID_FOREGROUND); CellRangeAddress[] regionsAdv = { CellRangeAddress.valueOf("A9:G9"), CellRangeAddress.valueOf("A10:G10"), CellRangeAddress.valueOf("A11:G11"), CellRangeAddress.valueOf("A12:G12"), CellRangeAddress.valueOf("A17:G17"), CellRangeAddress.valueOf("A18:G18"), CellRangeAddress.valueOf("A19:G19"), CellRangeAddress.valueOf("A20:G20"), CellRangeAddress.valueOf("A21:G21"), CellRangeAddress.valueOf("A22:G22"), CellRangeAddress.valueOf("A27:G27"), CellRangeAddress.valueOf("A28:G28"), CellRangeAddress.valueOf("A29:G29") }; /* Applying above created rule formatting to cells */ sheetCF.addConditionalFormatting(regionsAction, rule2); sheetCF.addConditionalFormatting(regionsAdv, rule3); /* Setting coloumn header values */ int mainCellIndex = 0; Cell cell0 = rowMain.createCell(mainCellIndex++); cell0.setCellValue("SNO"); cell0.setCellStyle(style1); Cell cell1 = rowMain.createCell(mainCellIndex++); cell1.setCellValue("Genre"); cell1.setCellStyle(style1); Cell cell2 = rowMain.createCell(mainCellIndex++); cell2.setCellValue("Credit Score"); cell2.setCellStyle(style1); Cell cell3 = rowMain.createCell(mainCellIndex++); cell3.setCellValue("Album Name"); cell3.setCellStyle(style1); Cell cell4 = rowMain.createCell(mainCellIndex++); cell4.setCellValue("Artist"); cell4.setCellStyle(style1); Cell cell5 = rowMain.createCell(mainCellIndex++); cell5.setCellValue("Release Date"); cell5.setCellStyle(style1); /* populating cell values */ int rowIndex = 4; int sno = 1; for (Song song : songList) { if (song.getSno() != 0) { Row row = songsSheet.createRow(rowIndex++); int cellIndex = 0; /* first place in row is Sno */ Cell cell20 = row.createCell(cellIndex++); cell20.setCellValue(sno++); cell20.setCellStyle(style14); /* second place in row is Genre */ Cell cell21 = row.createCell(cellIndex++); cell21.setCellValue(song.getGenre()); cell21.setCellStyle(style13); /* third place in row is Critic score */ Cell cell22 = row.createCell(cellIndex++); cell22.setCellValue(song.getCriticscore()); cell22.setCellStyle(style14); /* fourth place in row is Album name */ Cell cell23 = row.createCell(cellIndex++); cell23.setCellValue(song.getAlbumname()); cell23.setCellStyle(style13); /* fifth place in row is Artist */ Cell cell24 = row.createCell(cellIndex++); cell24.setCellValue(song.getArtist()); cell24.setCellStyle(style13); /* sixth place in row is marks in date */ if (song.getReleasedate() != null) { Cell date = row.createCell(cellIndex++); DataFormat format = workbook.createDataFormat(); CellStyle dateStyle = workbook.createCellStyle(); dateStyle.setDataFormat(format.getFormat("dd-MMM-yyyy")); date.setCellStyle(dateStyle); date.setCellValue(song.getReleasedate()); /* auto-resizing columns */ songsSheet.autoSizeColumn(6); songsSheet.autoSizeColumn(5); songsSheet.autoSizeColumn(4); songsSheet.autoSizeColumn(3); songsSheet.autoSizeColumn(2); } } } /* writing this workbook to excel file. */ try { FileOutputStream fos = new FileOutputStream(FILE_PATH); workbook.write(fos); fos.close(); System.out.println(FILE_PATH + " is successfully written"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.mycompany.modelinglab2.helperModel.ExcelHelper.ExcelHelper.java
/** * distance = x higth = y/* w w w . jav a 2s .c o m*/ */ public void formExcelFile(List distance, List higth) { File file = new File("C:\\Users\\Roman\\Desktop\\Experiment.xls"); // Workbook wb = new HSSFWorkbook(); try { Sheet sheet = wb.createSheet("Laboratory 2 (Modeling balls)"); // ? Font font = wb.createFont(); font.setBoldweight(font.ANSI_CHARSET); // ? ? ? Row row = sheet.createRow(0); row.createCell(0).setCellValue("???"); row.createCell(1).setCellValue("?"); for (int i = 0; i < distance.size(); i++) { row = sheet.createRow(i + 1); Cell distCell = row.createCell(0); Cell higthCell = row.createCell(1); distCell.setCellValue(distance.get(i).toString().replace('.', ',')); higthCell.setCellValue(higth.get(i).toString().replace('.', ',')); } // sheet.autoSizeColumn(0); // ? ?? wb.write(new FileOutputStream(file)); wb.close(); } catch (IOException ex) { Logger.getLogger(ExcelHelper.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.nc.common.utils.ExcelUtil.java
License:Open Source License
/** * <pre>/*www .j a v a 2 s.c om*/ * 1. : POI UTIL * 2. : POI WORKBOOK ? / String , List<Map<String, Object>> ? , List<Map<String, Object>> * </pre> * * @method Name : createWorkBook * @param workbook, sheetName, list, colNames * @return Workbook * @throws Exception * */ @SuppressWarnings("deprecation") public static Workbook createWorkBook(Workbook workbook, String sheetName, List<Map<String, Object>> list, List<Map<String, Object>> colNames) throws Exception { Row row; Cell cell; /* ? ? START */ /* Workbook workbook = new Workbook(); */ CellStyle titleStyle = workbook.createCellStyle(); CellStyle cellStyle = workbook.createCellStyle(); CellStyle contentStyle = workbook.createCellStyle(); CellStyle contentStyle_2 = workbook.createCellStyle(); /* ? */ /* ? ? */ Font titleFont = workbook.createFont(); titleFont.setFontHeightInPoints((short) 13); titleFont.setFontName("? "); /* ? */ Font colNameFont = workbook.createFont(); colNameFont.setFontHeightInPoints((short) 10); colNameFont.setFontName("? "); /* ? */ Font contentFont = workbook.createFont(); /* ? ? ? */ titleStyle.setFont(titleFont); /* ? / ? ? */ cellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); /* ? */ cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);//? cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); cellStyle.setFont(colNameFont); /* ? / ? */ contentStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); /* ? */ contentStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); contentStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); contentStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); contentStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); contentStyle.setFont(contentFont); /* ? / ? */ contentStyle_2.setBorderRight(HSSFCellStyle.BORDER_THIN); /* ? */ contentStyle_2.setBorderLeft(HSSFCellStyle.BORDER_THIN); contentStyle_2.setBorderTop(HSSFCellStyle.BORDER_THIN); contentStyle_2.setBorderBottom(HSSFCellStyle.BORDER_THIN); contentStyle_2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); contentStyle_2.setAlignment(HSSFCellStyle.ALIGN_LEFT); contentStyle_2.setFont(contentFont); /* ? */ Sheet sheet = workbook.createSheet(sheetName); /* ?? */ int sheet1_row = 0; List<Map<String, Object>> colList = colNames; /* ? START */ row = sheet.createRow(sheet1_row); for (int i = 0; i < colList.size(); i++) { cell = row.createCell(i); cell.setCellValue(String.valueOf(colList.get(i).get("item" + i))); cell.setCellStyle(cellStyle); } sheet1_row++; /* ? END */ for (Map<String, Object> map : list) { row = sheet.createRow(sheet1_row); for (int j = 0; j < colList.size(); j++) { cell = row.createCell(j); cell.setCellStyle(contentStyle); if (null != map.get(colList.get(j).get("item" + j))) { cell.setCellValue((double) map.get(String.valueOf(colList.get(j).get("item" + j)))); } else { cell.setCellValue(""); } /* ? ?? */ sheet.autoSizeColumn((short) j); sheet.setColumnWidth(j, (sheet.getColumnWidth(j)) + 312); } sheet1_row++; } return workbook; }
From source file:com.plugin.excel.util.ExcelFileHelper.java
License:Apache License
private static void autoSize(Sheet sheet, int totalColumn, boolean setWrap) { if (sheet != null) { for (int i = 0; i < totalColumn; i++) { sheet.autoSizeColumn((short) (i)); }/* w ww . j a v a 2 s . co m*/ } }
From source file:com.quanticate.opensource.datalistdownload.DataListDownloadWebScript.java
License:Open Source License
@Override protected void populateBody(Object resource, Workbook workbook, Sheet sheet, List<QName> properties) throws IOException { NodeRef list = (NodeRef) resource;/*w w w. ja v a 2 s.c o m*/ List<NodeRef> items = getItems(list); // Our various formats DataFormat formatter = workbook.createDataFormat(); CellStyle styleInt = workbook.createCellStyle(); styleInt.setDataFormat(formatter.getFormat("0")); CellStyle styleDate = workbook.createCellStyle(); styleDate.setDataFormat(formatter.getFormat("yyyy-mm-dd")); CellStyle styleDouble = workbook.createCellStyle(); styleDouble.setDataFormat(formatter.getFormat("General")); CellStyle styleNewLines = workbook.createCellStyle(); styleNewLines.setWrapText(true); // Export the items int rowNum = 1, colNum = 0; for (NodeRef item : items) { Row r = sheet.createRow(rowNum); colNum = 0; for (QName prop : properties) { Cell c = r.createCell(colNum); Pair<Object, String> valAndLink = identifyValueAndLink(item, prop); if (valAndLink == null) { // This property isn't set c.setCellType(Cell.CELL_TYPE_BLANK); } else { Object val = valAndLink.getFirst(); // Multi-line property? if (val instanceof String[]) { String[] lines = (String[]) val; StringBuffer text = new StringBuffer(); for (String line : lines) { if (text.length() > 0) { text.append('\n'); } text.append(line); } String v = text.toString(); c.setCellValue(v); if (lines.length > 1) { c.setCellStyle(styleNewLines); r.setHeightInPoints(lines.length * sheet.getDefaultRowHeightInPoints()); } } // Regular properties else if (val instanceof String) { c.setCellValue((String) val); } else if (val instanceof Date) { c.setCellValue((Date) val); c.setCellStyle(styleDate); } else if (val instanceof Integer || val instanceof Long) { double v = 0.0; if (val instanceof Long) v = (double) (Long) val; if (val instanceof Integer) v = (double) (Integer) val; c.setCellValue(v); c.setCellStyle(styleInt); } else if (val instanceof Float || val instanceof Double) { double v = 0.0; if (val instanceof Float) v = (double) (Float) val; if (val instanceof Double) v = (double) (Double) val; c.setCellValue(v); c.setCellStyle(styleDouble); } else { // TODO System.err .println("TODO: Handle Excel output of " + val.getClass().getName() + " - " + val); } } colNum++; } rowNum++; } // Sensible column widths please! colNum = 0; for (QName prop : properties) { sheet.autoSizeColumn(colNum); colNum++; } }
From source file:com.runwaysdk.dataaccess.io.ExcelExportSheet.java
License:Open Source License
protected void writeHeader(Sheet sheet, Drawing drawing, Row nameRow, Row labelRow, int i, ExcelColumn column, CellStyle boldStyle) {// ww w . j av a 2 s . com CreationHelper helper = sheet.getWorkbook().getCreationHelper(); // Notify the listeners for (ExcelExportListener listener : listeners) { listener.preHeader(column); } nameRow.createCell(i).setCellValue(helper.createRichTextString(column.getAttributeName())); Cell cell = labelRow.createCell(i); cell.setCellValue(helper.createRichTextString(column.getDisplayLabel())); if (column.isRequired() && boldStyle != null) { cell.setCellStyle(boldStyle); } if (column.getDescription() != null && column.getDescription().length() > 0) { ClientAnchor anchor = helper.createClientAnchor(); anchor.setDx1(0); anchor.setDy1(0); anchor.setDx2(0); anchor.setDy2(0); anchor.setCol1(0); anchor.setRow1(0); anchor.setCol2(0); anchor.setRow2(4); Comment comment = drawing.createCellComment(anchor); comment.setString(helper.createRichTextString(column.getDescription())); cell.setCellComment(comment); } sheet.autoSizeColumn((short) i); }
From source file:com.runwaysdk.dataaccess.io.ExcelImporter.java
License:Open Source License
/** * Writes out errors to the correct sheet. Inclusion of the "Column" column is based on the passed parameter. "Row" and "Message" columns are always included. * /* w ww . j a v a2s. co m*/ * @param includeColumn */ private void writeMessages(boolean includeColumn) { int col = 0; CreationHelper helper = errorWorkbook.getCreationHelper(); Sheet sheet = errorWorkbook.getSheet(ERROR_SHEET); Row row = sheet.createRow(0); row.createCell(col++).setCellValue(helper.createRichTextString("Row")); row.createCell(col++).setCellValue(helper.createRichTextString("Sheet")); if (includeColumn) { row.createCell(col++).setCellValue(helper.createRichTextString("Column")); } row.createCell(col++).setCellValue(helper.createRichTextString("Error Message")); int i = 1; for (ImportContext c : contexts) { for (ExcelMessage message : c.getErrorMessages()) { col = 0; row = sheet.createRow(i++); row.createCell(col++).setCellValue(message.getRow()); row.createCell(col++).setCellValue(helper.createRichTextString(c.getSheetName())); if (includeColumn) { row.createCell(col++).setCellValue(helper.createRichTextString(message.getColumn())); } row.createCell(col++).setCellValue(helper.createRichTextString(message.getMessage())); } } short c = 0; sheet.autoSizeColumn(c++); if (includeColumn) { sheet.autoSizeColumn(c++); } sheet.autoSizeColumn(c++); }
From source file:com.siemens.sw360.exporter.ExcelExporter.java
License:Open Source License
public InputStream makeExcelExport(List<T> documents) throws IOException { final Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet("Component Data"); /** Adding styles to cells */ CellStyle cellStyte = createCellStyte(workbook); CellStyle headerStyle = createHeaderStyle(workbook); /** Create header row */ Row headerRow = sheet.createRow(0);// w w w . ja va 2s . c o m List<String> headerNames = helper.getHeaders(); fillRow(headerRow, headerNames, headerStyle); /** Create data rows */ fillValues(sheet, documents, cellStyte); /** Resize the columns */ for (int iColumns = 0; iColumns < nColumns; iColumns++) { sheet.autoSizeColumn(iColumns); } /** Copy the streams */ final ByteArrayOutputStream out = new ByteArrayOutputStream(); workbook.write(out); return new ByteArrayInputStream(out.toByteArray()); }
From source file:com.tecnosur.util.Excel.java
public void ExportarMatriculados(CControlmatricula datos, String aula) { try { // Defino el Libro de Excel HSSFWorkbook wb = new HSSFWorkbook(); // Creo la Hoja en Excel Sheet sheet = wb.createSheet("matriculados"); // quito las lineas del libro para darle un mejor acabado sheet.setDisplayGridlines(false); sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 6)); // creo una nueva fila Row trow = sheet.createRow((short) 1); createTituloCell(wb, trow, 0, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "ALUMNOS MATRICULADOS"); Row trow2 = sheet.createRow((short) 3); createTituloCell(wb, trow2, 0, CellStyle.ALIGN_LEFT, CellStyle.VERTICAL_CENTER, "AULA: " + aula); // Creo la cabecera de mi listado en Excel Row row = sheet.createRow((short) 5); // Creo las celdas de mi fila, se puede poner un diseo a la celda_codigo createCell(wb, row, 0, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CDIGO", true, true); createCell(wb, row, 1, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "ALUMNO", true, true); createCell(wb, row, 2, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "TIPO PAGO", true, true); createCell(wb, row, 3, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CRONO. PAGO", true, true); createCell(wb, row, 4, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "N CUOT.", true, true); createCell(wb, row, 5, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MON. MATR.", true, true); createCell(wb, row, 6, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MON. CUOT.", true, true); // Definimos el tamao de las celdas, podemos definir un tamaa especifico o hacer que //la celda_codigo se acomode segn su tamao Sheet ssheet = wb.getSheetAt(0); ssheet.setColumnWidth(0, 60 * 40); ssheet.setColumnWidth(1, 255 * 40); ssheet.setColumnWidth(2, 90 * 40); ssheet.autoSizeColumn(3); ssheet.autoSizeColumn(4);/*from w w w .java 2 s . c o m*/ ssheet.autoSizeColumn(5); ssheet.autoSizeColumn(6); HSSFFont cellFont = wb.createFont(); cellFont.setFontHeightInPoints((short) 8); cellFont.setFontName(HSSFFont.FONT_ARIAL); CellStyle cellStyle = wb.createCellStyle(); cellStyle.setFont(cellFont); cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); cellStyle.setLeftBorderColor((short) 8); cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); cellStyle.setRightBorderColor((short) 8); cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); cellStyle.setBottomBorderColor((short) 8); for (int i = 0; i < datos.size(); i++) { row = sheet.createRow((short) i + 6); Cell celda_codigo = row.createCell(0); celda_codigo.setCellStyle(cellStyle); celda_codigo.setCellValue(datos.get(i).getIdalumno()); Cell celda_alumno = row.createCell(1); celda_alumno.setCellStyle(cellStyle); celda_alumno.setCellValue(datos.get(i).getNom_completo()); Cell celda_tipopago = row.createCell(2); celda_tipopago.setCellStyle(cellStyle); celda_tipopago.setCellValue(datos.get(i).getTipopagante()); Cell celda_crono = row.createCell(3); celda_crono.setCellStyle(cellStyle); celda_crono.setCellValue(datos.get(i).getDesc_cronopagtable()); Cell celda_ncuota = row.createCell(4); celda_ncuota.setCellStyle(cellStyle); celda_ncuota.setCellValue(datos.get(i).getNum_cuota()); Cell celda_matricula = row.createCell(5); celda_matricula.setCellStyle(cellStyle); celda_matricula.setCellValue(datos.get(i).getMonmatricula()); Cell celda_moncuota = row.createCell(6); celda_moncuota.setCellStyle(cellStyle); celda_moncuota.setCellValue(datos.get(i).getMoncuota()); } String strRuta = "TYSAC_Matriculados.xls"; FileOutputStream fileOut = new FileOutputStream(strRuta); wb.write(fileOut); fileOut.close(); Runtime.getRuntime().exec("cmd /c start " + strRuta); } catch (IOException e) { System.out.println("Error de escritura"); e.printStackTrace(); } }
From source file:com.tikal.tallerWeb.servicio.reporte.global.GeneradorReporteGlobal.java
License:Apache License
private void llenarEncabezado(Sheet sheet, int row, int col) { int cellCount = col; Cell actual;/*w w w. ja va2 s .c o m*/ Row r = sheet.createRow(row); for (String x : encabezado) { actual = r.createCell(cellCount); actual.setCellValue(x); sheet.autoSizeColumn(cellCount); cellCount = cellCount + 1; } }