I had to save my file into disk, and read it again later with a File type to save it into a StreamedContent.
The code:
HSSFWorkbook libro = new HSSFWorkbook();
FileOutputStream elFichero = new FileOutputStream("c:/Temp/MyExcel.xls");
libro.write(elFichero);
elFichero.close();
libro.close();
File fil = new File("c:/Temp/MyExcel.xls");
StreamedContent excel = new DefaultStreamedContent(new FileInputStream(fil), new MimetypesFileTypeMap().getContentType(fil), "MyExcel.xls"));
later i could get my excel file by the <p:commandButton>
.
Anyways i was looking for a way to try not to save it to disk before download...