Utilizando o POI.
Através do código abaixo e gerado a planilha corretamente no path informado.
FileOutputStream out = new FileOutputStream("C:\\"+file);
wb.write(out); // gera a planilha no path informado
bytes = wb.getBytes();
out.close();
ao recuberar o array de bytes exibindo a planilha utilizando um Servlet
response.setContentType ( "application/application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=sample.xls;");
response.setHeader ( "Pragma", "no-cache" ); //HTTP 1.0
response.setDateHeader ( "Expires", 0 ); //prevents caching at the proxy server
response.setHeader ( "Cache-Control", "no-cache" ); //HTTP 1.1
response.setHeader ( "Cache-Control", "max-age=0" );
response.setHeader("Accept-Ranges:","bytes");
response.setContentLength( bytes.length);
response.getOutputStream().write(bytes);
A planilha abre sem nenhuma formatação.
Alguém sabe por que isso ocorre?