I have this method for exporting an excel doc, but when I open the excel I get this kind of file with weird characters and symbols, no formatting; can someone guide me how to fix this?

This is my method, thanks for the help; I am still working on this.
public void CrearExcel() throws SQLException {
//Map param = new HashMap();
try {
Connection conn = Conexion.getConnTest();
PreparedStatement ps = null;
ResultSet rs = null;
String sql =
"SELECT NUM_FICHA, ASPIRANTE.AP_PATERNO, ASPIRANTE.AP_MATERNO, ASPIRANTE.NOMBRE FROM REFERENCIA INNER JOIN ASPIRANTE ON REFERENCIA.FK_ASPIRANTE_ID_ASPIRANTE = ASPIRANTE.ID_USUARIO WHERE NUM_FICHA IS NOT NULL";
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
HSSFWorkbook hwb = new HSSFWorkbook();
HSSFSheet sheet = hwb.createSheet("new sheet");
Row rowhead = sheet.createRow(0);
rowhead.createCell(0).setCellValue("NUMFICHA");
rowhead.createCell(1).setCellValue("APELLIDO PATERNO");
rowhead.createCell(2).setCellValue("APELLIDO MATERNO");
rowhead.createCell(3).setCellValue("NOMBRE");
rowhead.createCell(4).setCellValue("EXAMEN1");
rowhead.createCell(5).setCellValue("EXAMEN2");
int index = 1;
while (rs.next()) {
Row row = sheet.createRow(index);
row.createCell(0).setCellValue(rs.getInt(1));
row.createCell(1).setCellValue(rs.getString(2));
row.createCell(2).setCellValue(rs.getString(3));
row.createCell(3).setCellValue(rs.getString(4));
row.createCell(4).setCellValue("");
row.createCell(5).setCellValue("");
index++;
}
ByteArrayOutputStream outByteStream = new ByteArrayOutputStream();
hwb.write(outByteStream);
byte[] outArray = outByteStream.toByteArray();
response.setHeader("Content-Disposition",
"attachment; filename=testxls.xls");
response.setContentType("application/vnd.ms-excel");
response.flushBuffer();
OutputStream outStream = response.getOutputStream();
outStream.write(outArray);
outStream.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Since Excel files can receive text content, instead of printing out binary data, try printing out text data. If that doesn’t resolve the issue, it should at least be able to point you in a better direction than printing binary data.