List of usage examples for org.apache.poi.hssf.usermodel HSSFCellStyle setBorderTop
@Override public void setBorderTop(BorderStyle border)
From source file:ua.com.ecotep.unianalysis.export.XLSDataExport.java
@Override public void exportData(String selectedFile, AnProperties props, ObservableList<ObservableList<Object>> exportData, List<String> columnTitles) throws Exception { if (selectedFile == null) { return;//from ww w.ja v a2 s . co m } System.setProperty("java.awt.headless", "true"); HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("Sheet1"); HSSFPrintSetup ps = sheet.getPrintSetup(); ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); ps.setLandscape(true); HSSFCellStyle cellStyleT = wb.createCellStyle(); HSSFFont font1 = wb.createFont(); font1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); font1.setFontHeightInPoints((short) 8); cellStyleT.setFont(font1); int rnumber = 0; HSSFRow row = sheet.createRow(0); sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 10)); HSSFCell cell = row.createCell(0); cell.setCellValue( new HSSFRichTextString(" ??? ??? - " + DateConverters.getDateToStr(LocalDate.now()))); cell.setCellStyle(cellStyleT); rnumber++; if (props != null) { String val = " : " + DateConverters.getDateToStr(props.getDateFrom()) + " " + DateConverters.getDateToStr(props.getDateTo()); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; //---------- if (props.isSalMode()) { String type = props.getSalSalerType() == AnProperties.SALER_TYPES.PROFILE ? " " : " "; val = "? " + type + "| " + props.getSaler().getNameSaler(); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; if (props.getSalSalerType() == AnProperties.SALER_TYPES.SALER) { type = props.isSalDirectSales() ? "? " : " "; val = " : " + type; createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; if (props.isSalFixedDepartment()) { val = " : "; createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } } } if (props.isGoodMode()) { if (props.getGoodClassLev0() != null) { val = "? 1: " + props.getGoodClassLev0().getName(); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; if (props.getGoodClassLev1() != null) { val = "? 2: " + props.getGoodClassLev1().getName(); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; if (props.getGoodClassLev2() != null) { val = "? 3: " + props.getGoodClassLev2().getName(); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; if (props.getGoodClassLev3() != null) { val = "? 4: " + props.getGoodClassLev3().getName(); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } } } if (props.getGoodCustomSearch() != null && !props.getGoodCustomSearch().isEmpty()) { val = " : " + props.getGoodCustomSearch(); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } if (props.isGoodPeriodAnalysis() && props.getGoodsIndateLst().size() == 2) { val = " : " + DateConverters.getDateToStr(props.getGoodsIndateLst().get(0)); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; val = " : " + DateConverters.getDateToStr(props.getGoodsIndateLst().get(1)); createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } if (!props.isGoodPeriodAnalysis() && props.getGoodsIndateLst().size() > 0) { val = "+: "; for (LocalDate ld : props.getGoodsIndateLst()) { val += DateConverters.getDateToStr(ld) + "; "; } createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } } } if (!props.getClLst().isEmpty()) { if (props.isClIncluded()) { val = " : "; createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } else { val = " : "; createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } val = "+: "; for (ClientBean cb : props.getClLst()) { val += cb.getClientCl() + "; "; } createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } if (!props.getVLst().isEmpty()) { if (props.isVIncluded()) { val = " : "; createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } else { val = " : "; createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } val = ""; for (String v : props.getVLst()) { val += v + "; "; } createHeaderCell(sheet, rnumber, val, cellStyleT); rnumber++; } } //---------- HSSFCellStyle cellStyleH = wb.createCellStyle(); HSSFFont font = wb.createFont(); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); cellStyleH.setFont(font); cellStyleH.setWrapText(true); cellStyleH.setAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyleH.setVerticalAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyleH.setBorderLeft((short) 1); cellStyleH.setBorderRight((short) 1); cellStyleH.setBorderTop((short) 1); cellStyleH.setBorderBottom((short) 1); HSSFCellStyle cellStyleHh = wb.createCellStyle(); font = wb.createFont(); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); cellStyleHh.setFont(font); cellStyleHh.setWrapText(true); cellStyleHh.setAlignment(HSSFCellStyle.ALIGN_RIGHT); cellStyleHh.setVerticalAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyleHh.setBorderLeft((short) 1); cellStyleHh.setBorderRight((short) 1); cellStyleHh.setBorderTop((short) 1); cellStyleHh.setBorderBottom((short) 1); //filling table HSSFCellStyle cellStyleN = wb.createCellStyle(); cellStyleN.setAlignment(HSSFCellStyle.ALIGN_LEFT); cellStyleN.setVerticalAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyleN.setBorderLeft((short) 1); cellStyleN.setBorderRight((short) 1); cellStyleN.setBorderTop((short) 1); cellStyleN.setBorderBottom((short) 1); HSSFCellStyle cellStyleI = wb.createCellStyle(); cellStyleI.setAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyleI.setVerticalAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyleI.setBorderLeft((short) 1); cellStyleI.setBorderRight((short) 1); cellStyleI.setBorderTop((short) 1); cellStyleI.setBorderBottom((short) 1); HSSFCellStyle cellStyleD = wb.createCellStyle(); cellStyleD.setAlignment(HSSFCellStyle.ALIGN_RIGHT); cellStyleD.setVerticalAlignment(HSSFCellStyle.ALIGN_RIGHT); HSSFDataFormat df = wb.createDataFormat(); cellStyleD.setDataFormat(df.getFormat("#,##0.0")); cellStyleD.setBorderLeft((short) 1); cellStyleD.setBorderRight((short) 1); cellStyleD.setBorderTop((short) 1); cellStyleD.setBorderBottom((short) 1); HSSFCellStyle cellStyleP = wb.createCellStyle(); cellStyleP.setAlignment(HSSFCellStyle.ALIGN_RIGHT); cellStyleP.setVerticalAlignment(HSSFCellStyle.ALIGN_RIGHT); cellStyleP.setDataFormat(df.getFormat("0.0\\%")); cellStyleP.setBorderLeft((short) 1); cellStyleP.setBorderRight((short) 1); cellStyleP.setBorderTop((short) 1); cellStyleP.setBorderBottom((short) 1); // filling column headers row = sheet.createRow(rnumber); String rowTitle = null; row = sheet.createRow(rnumber); row.setHeightInPoints(40); cell = row.createCell(0); cell.setCellValue(new HSSFRichTextString("?")); cell.setCellStyle(cellStyleH); for (int t = 0; t < columnTitles.size(); t++) { cell = row.createCell(t + 1); cell.setCellValue(new HSSFRichTextString(columnTitles.get(t))); cell.setCellStyle(cellStyleH); } // filling table with data rnumber++; for (ObservableList<Object> line : exportData) { row = sheet.createRow(rnumber); cell = row.createCell(0); cell.setCellValue(new HSSFRichTextString((String) line.get(0))); cell.setCellStyle(cellStyleN); for (int i = 1; i < line.size(); i++) { Double val = (Double) line.get(i); cell = row.createCell(i); cell.setCellStyle(cellStyleD); cell.setCellValue(val); } rnumber++; } for (int t = 0; t < columnTitles.size(); t++) { sheet.autoSizeColumn((short) t); } saveWorkBook(wb, selectedFile); execute(selectedFile); }
From source file:uk.co.spudsoft.birt.emitters.excel.StyleManagerHUtils.java
License:Open Source License
@Override public void applyBorderStyle(Workbook workbook, CellStyle style, BorderSide side, CSSValue colour, CSSValue borderStyle, CSSValue width) { if ((colour != null) || (borderStyle != null) || (width != null)) { String colourString = colour == null ? "rgb(0,0,0)" : colour.getCssText(); String borderStyleString = borderStyle == null ? "solid" : borderStyle.getCssText(); String widthString = width == null ? "medium" : width.getCssText(); if (style instanceof HSSFCellStyle) { HSSFCellStyle hStyle = (HSSFCellStyle) style; short hBorderStyle = poiBorderStyleFromBirt(borderStyleString, widthString); short colourIndex = getHColour((HSSFWorkbook) workbook, colourString); if (colourIndex > 0) { if (hBorderStyle != CellStyle.BORDER_NONE) { switch (side) { case TOP: hStyle.setBorderTop(hBorderStyle); hStyle.setTopBorderColor(colourIndex); // log.debug( "Top border: " + xStyle.getBorderTop() + " / " + xStyle.getTopBorderXSSFColor().getARGBHex() ); break; case LEFT: hStyle.setBorderLeft(hBorderStyle); hStyle.setLeftBorderColor(colourIndex); // log.debug( "Left border: " + xStyle.getBorderLeft() + " / " + xStyle.getLeftBorderXSSFColor().getARGBHex() ); break; case RIGHT: hStyle.setBorderRight(hBorderStyle); hStyle.setRightBorderColor(colourIndex); // log.debug( "Right border: " + xStyle.getBorderRight() + " / " + xStyle.getRightBorderXSSFColor().getARGBHex() ); break; case BOTTOM: hStyle.setBorderBottom(hBorderStyle); hStyle.setBottomBorderColor(colourIndex); // log.debug( "Bottom border: " + xStyle.getBorderBottom() + " / " + xStyle.getBottomBorderXSSFColor().getARGBHex() ); break; }/*from w w w . ja v a2 s . c o m*/ } } } } }
From source file:vista.AforoPanel.java
public HSSFWorkbook ObtenerDatosExcel() { List<Vertical> verticales = new ArrayList(); List<Celda> celdas = new ArrayList(); verjpa = new VerticalJPA(); celjpa = new CeldaJPA(); verticales = verjpa.ListarVerticales(aforo.getIdaforo()); celdas = celjpa.ListarCeldas(aforo.getIdaforo()); //verticales = (List<Vertical>) aforo.getVerticalCollection(); //celdas = (List<Celda>) aforo.getCeldaCollection(); HSSFWorkbook libro = new HSSFWorkbook(); HSSFSheet hoja = libro.createSheet(); HSSFCellStyle style = libro.createCellStyle(); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); style.setBorderTop(HSSFCellStyle.BORDER_THIN); style.setBorderRight(HSSFCellStyle.BORDER_THIN); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); style.setWrapText(true);//w w w . ja va2s.c o m style.setHidden(true); style.setShrinkToFit(true); SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy"); SimpleDateFormat hour = new SimpleDateFormat("HH:mm:ss"); Calendar fecha = Calendar.getInstance(); fecha.set(aforo.getAnho(), aforo.getMes() - 1, aforo.getDia(), aforo.getHoraInicio(), aforo.getMinutoInicio(), aforo.getSegundoInicio()); //*****************DATOS AFORRO***********************// HSSFRow fila = hoja.createRow(2); HSSFCell celda = fila.createCell((int) 3); celda.setCellValue("AFORO"); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("VERTICAL 1"); celda.setCellStyle(style); celda = fila.createCell((int) 10); celda.setCellValue("CELDA 1"); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(3); celda = fila.createCell((int) 3); celda.setCellValue("Nombre"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getNombre()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Profundidad[cm]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getProfundidad()); celda.setCellStyle(style); celda = fila.createCell((int) 10); celda.setCellValue("Ancho[m]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(0).getProfundidad()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(4); celda = fila.createCell((int) 3); celda.setCellValue("Tipo"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getTipoAforo()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Dist_a_orilla[m]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getDistOrilla()); celda.setCellStyle(style); celda = fila.createCell((int) 10); celda.setCellValue("Profundidad[cm]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(0).getAncho()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(5); celda = fila.createCell((int) 3); celda.setCellValue("Helice"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getHelice()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVelocidad()); celda.setCellStyle(style); celda = fila.createCell((int) 10); celda.setCellValue("Area[m^2]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(0).getArea()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(6); celda = fila.createCell((int) 3); celda.setCellValue("Numero de Celdas"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getNumeroCeldas()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_sup[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVelocidadSup()); celda.setCellStyle(style); celda = fila.createCell((int) 10); celda.setCellValue("Velocidad[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(0).getVelocidad()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(7); celda = fila.createCell((int) 3); celda.setCellValue("Numero de Verticales"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getNumeroVerticales()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_fondo[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVelocidadFondo()); celda.setCellStyle(style); celda = fila.createCell((int) 10); celda.setCellValue("Caudal[m^3/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(0).getCaudal()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(8); celda = fila.createCell((int) 3); celda.setCellValue("Tiempo de Aforo[s]"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getTiempoAforo()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_20[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVelocidad20()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(9); celda = fila.createCell((int) 3); celda.setCellValue("Fecha"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(date.format(fecha.getTime())); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_40[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVelocidad40()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(10); celda = fila.createCell((int) 3); celda.setCellValue("Hora inicio"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(hour.format(fecha.getTime())); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_60[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVelocidad60()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(11); celda = fila.createCell((int) 3); celda.setCellValue("Hora fin"); celda.setCellStyle(style); celda = fila.createCell((int) 4); fecha.set(aforo.getAnho(), aforo.getMes() - 1, aforo.getDia(), aforo.getHoraFin(), aforo.getMinutoFin(), aforo.getSegundoFin()); celda.setCellValue(hour.format(fecha.getTime())); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_80[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVelocidad80()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(12); celda = fila.createCell((int) 3); celda.setCellValue("Longitud total[m]"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getLongitudTotal()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_sup[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVueltasSup()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(13); celda = fila.createCell((int) 3); celda.setCellValue("Profundidad media[cm]"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getProfundidadMedia()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_fondo[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVueltasFondo()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(14); celda = fila.createCell((int) 3); celda.setCellValue("Velocidad media[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getVelocidadMedia()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_20[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVueltas20()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(15); celda = fila.createCell((int) 3); celda.setCellValue("Area total[m^2]"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getAreaTotal()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_40[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVueltas40()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(16); celda = fila.createCell((int) 3); celda.setCellValue("Caudal total[m^3/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getCaudalTotal()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_60[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVueltas60()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(17); celda = fila.createCell((int) 3); celda.setCellValue("Mira inicial[cm]"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getMiraInicial()); celda.setCellStyle(style); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_80[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(0).getVueltas80()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(18); celda = fila.createCell((int) 3); celda.setCellValue("Mira final[cm]"); celda.setCellStyle(style); celda = fila.createCell((int) 4); celda.setCellValue(aforo.getMiraFinal()); celda.setCellStyle(style); //******************************************// //*****************DATOS VERTICALES***********************// for (int i = 1; i < verticales.size(); i++) { fila = hoja.createRow(3 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("VERTICAL " + (i + 1)); celda.setCellStyle(style); if (i < celdas.size()) { celda = fila.createCell((int) 10); celda.setCellValue("CELDA " + (i + 1)); celda.setCellStyle(style); } //******************************************// fila = hoja.createRow(4 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Profundidad[cm]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getProfundidad()); celda.setCellStyle(style); if (i < celdas.size()) { celda = fila.createCell((int) 10); celda.setCellValue("Ancho[m]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(i).getAncho()); celda.setCellStyle(style); } //******************************************// fila = hoja.createRow(5 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Dist_a_orilla[m]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getDistOrilla()); celda.setCellStyle(style); if (i < celdas.size()) { celda = fila.createCell((int) 10); celda.setCellValue("Profundidad[cm]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(i).getProfundidad()); celda.setCellStyle(style); } //******************************************// fila = hoja.createRow(6 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVelocidad()); celda.setCellStyle(style); if (i < celdas.size()) { celda = fila.createCell((int) 10); celda.setCellValue("Area[m^2]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(i).getArea()); celda.setCellStyle(style); } //******************************************// fila = hoja.createRow(7 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_sup[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVelocidadSup()); celda.setCellStyle(style); if (i < celdas.size()) { celda = fila.createCell((int) 10); celda.setCellValue("Velocidad[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(i).getVelocidad()); celda.setCellStyle(style); } //******************************************// fila = hoja.createRow(8 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_fondo[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVelocidadFondo()); celda.setCellStyle(style); if (i < celdas.size()) { celda = fila.createCell((int) 10); celda.setCellValue("Caudal[m^3/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 11); celda.setCellValue(celdas.get(i).getCaudal()); celda.setCellStyle(style); } //******************************************// fila = hoja.createRow(9 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_20[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVelocidad20()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(10 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_40[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVelocidad40()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(11 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_60[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVelocidad60()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(12 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Velocidad_80[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVelocidad80()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(13 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_sup[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVueltasSup()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(14 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_fondo[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVueltasFondo()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(15 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_20[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVueltas20()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(16 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_40[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVueltas40()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(17 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_60[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVueltas60()); celda.setCellStyle(style); //******************************************// fila = hoja.createRow(18 + (17 * i)); celda = fila.createCell((int) 7); celda.setCellValue("Vueltas_80[m/s]"); celda.setCellStyle(style); celda = fila.createCell((int) 8); celda.setCellValue(verticales.get(i).getVueltas80()); celda.setCellStyle(style); } for (int i = 0; i < 12; i++) { hoja.autoSizeColumn(i); } return libro; }