From fdaf9bd3af739bec2aec3b7009a4b295bcecb2dc Mon Sep 17 00:00:00 2001 From: Daniel Cortes Date: Wed, 27 Feb 2019 14:10:35 -0300 Subject: [PATCH] Los bordes del se crean respecto a las filas Antes se hacian con los ids de las filas peros e decidio hacerlo automaticamente y leer las filas guardadas para obtener sus ids y utilizarlos para crear los bordes. --- .../xyz/informes/InformeEstadoResultado.java | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/src/danielcortes/xyz/informes/InformeEstadoResultado.java b/src/danielcortes/xyz/informes/InformeEstadoResultado.java index 8d47ef2..a0bc473 100644 --- a/src/danielcortes/xyz/informes/InformeEstadoResultado.java +++ b/src/danielcortes/xyz/informes/InformeEstadoResultado.java @@ -334,22 +334,37 @@ public class InformeEstadoResultado { private void addBorders() { PropertyTemplate pt = new PropertyTemplate(); - pt.drawBorders(new CellRangeAddress(0, 0, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(5, 5, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(7, 7, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(16, 16, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(18, 18, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(24, 24, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(26, 26, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(33, 33, 0, 1), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(35, 35, 0, 2), BorderStyle.THIN, BorderExtent.OUTSIDE); - pt.drawBorders(new CellRangeAddress(42, 42, 0, 2), BorderStyle.THIN, BorderExtent.OUTSIDE); + for(Row header: headers){ + int rowNum = header.getRowNum(); + CellRangeAddress range = new CellRangeAddress(rowNum, rowNum, 0, 1) ; + pt.drawBorders(range, BorderStyle.THIN, BorderExtent.OUTSIDE); + } - pt.drawBorders(new CellRangeAddress(1, 4, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); - pt.drawBorders(new CellRangeAddress(8, 15, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); - pt.drawBorders(new CellRangeAddress(19, 23, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); - pt.drawBorders(new CellRangeAddress(27, 32, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); - pt.drawBorders(new CellRangeAddress(36, 41, 0, 2), BorderStyle.THIN, BorderExtent.VERTICAL); + for(Row footer: footers){ + int rowNum = footer.getRowNum(); + CellRangeAddress range = new CellRangeAddress(rowNum, rowNum, 0, 1) ; + pt.drawBorders(range, BorderStyle.THIN, BorderExtent.OUTSIDE); + } + + int ventaStart = ventaRows.get(0).getRowNum(); + int ventaEnd = ventaRows.get(ventaRows.size() - 1).getRowNum(); + pt.drawBorders(new CellRangeAddress(ventaStart, ventaEnd, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); + + int gastosOperacionalesStart = gastosOperacionalesRows.get(0).getRowNum(); + int gastosOperacionalesEnd = gastosOperacionalesRows.get(gastosOperacionalesRows.size() - 1).getRowNum(); + pt.drawBorders(new CellRangeAddress(gastosOperacionalesStart, gastosOperacionalesEnd, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); + + int serviciosStart = serviciosRows.get(0).getRowNum(); + int serviciosEnd = serviciosRows.get(serviciosRows.size() - 1).getRowNum(); + pt.drawBorders(new CellRangeAddress(serviciosStart, serviciosEnd, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); + + int gastosGeneralesStart = gastosGeneralesRows.get(0).getRowNum(); + int gastosGeneralesEnd = gastosGeneralesRows.get(gastosGeneralesRows.size() - 1).getRowNum(); + pt.drawBorders(new CellRangeAddress(gastosGeneralesStart, gastosGeneralesEnd, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); + + int resumenStart = resumenGeneralRows.get(0).getRowNum(); + int resumenEnd = resumenGeneralRows.get(resumenGeneralRows.size() - 1).getRowNum(); + pt.drawBorders(new CellRangeAddress(resumenStart, resumenEnd, 0, 1), BorderStyle.THIN, BorderExtent.VERTICAL); pt.applyBorders(this.sheet); }