poi 生成文件后缀不对
。。。。。。。 直接贴字母吧
<!----------------------- service ---------------------------------------->
XSSFWorkbook wb = new XSSFWorkbook();
Map<String,List<Object>> map = getHqlAndCondition(condition);
List<Object> hql = map.get("hql");
List<Object> queryCondition = map.get("condition");
List<Object[]> list = commonDAO.queryForList(hql.get(0).toString(),queryCondition.toArray());
XSSFSheet sheet = wb.createSheet("影像数据");
XSSFRow row=null;
//列头
row = sheet.createRow(0);
row.createCell(0).setCellValue("录入状态");
int i = 0;
for (Object[] obj : list) {
row = sheet.createRow(i+1);
row.createCell(0).setCellValue(enterState);
//影像ID
String id = "";
if(null != obj[0]){
id = obj[0].toString();
}
row.createCell(1).setCellValue(id);
i++;
}
insertOperationLog("文件导出","文件导出");
return wb;
<!----------------------- Action ---------------------------------------->
XSSFWorkbook wb = screenageStatsServie.doExport(model.getCondition());
setDocName("影像统计");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
wb.write(baos);
} catch (IOException e) {
e.printStackTrace();
}
byte[] ba = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(ba);
model.setBais(bais);
这明明是个2007的啊 怎么生成出来的 是 xls格式??? 求解