Servlet and XSSF workbook

0

I have a problem writing in the return flow of the servlet, it reads the file and I can modify it, but at the time of returning it shows me in my browser that if I want to save a binary file and it does not give me a name, On the other hand, if I just save it in a file on the server side, it keeps Excel well, and I do not know what could be happening, I leave my part of my code.

    final int FILA_INICIAL  = 5 ;
    ServletOutputStream out = response.getOutputStream();
    String ruta = request.getServletContext().getRealPath("/plantilla_importar");
    ruta = ruta.endsWith("/") ? ruta : ruta + "/";
    String archivo = "PlantillaImportarPropiedadesFinancieras.xlsx";

        XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(ruta + archivo));
        Sheet sheet = wb.getSheetAt(0);
        int idx = FILA_INICIAL;
        for(PropiedadesFinancierasVO pf : lpf){
            Row r = sheet.createRow(idx);
            r.createCell(TIPO_TERCERO).setCellValue(tipo.toString());
            idx++;
        }
        wb.write(out);
    
asked by Bruno Torres 25.07.2018 в 02:08
source

0 answers