public void CreateProjectVessionScoreExcel(){
try {
CreateExcel c=new CreateExcel();
int filei=0;
// list中存放的对象的class
String className = "com.huawei.sdmp.data.ProjectVessionScore";
// 表头
String[] headerArray = null;
// 需要执行的方法对象
List<Method> headerKeyArray = getMethods(className, headerDataKey);
// 替换掉所有的<br/>换行符
header = header.replaceAll("</br>", "");
if (StringUtils.isNotBlank(header))
headerArray = StringUtils.split(header, ",");
String[] select = { "开始时间:" + startTime, "结束时间:" + endTime };
List<?> listSumCreate=(List<?>)getRequest().getSession().getAttribute("listSumCreate");
String fileName = System.getProperty("java.io.tmpdir")+"\\xls"+(new java.util.Date().getTime())+(filei++);
WritableWorkbook wwb = Workbook.createWorkbook(new File(fileName));
// 添加第一个工作表并设置第一个Sheet的名字
WritableSheet sheet = wwb.createSheet("PDUCI持续集成", 0);
try {
c.CraeateExce(select, headerArray, sheet);
if (listSumCreate != null && headerKeyArray != null && headerArray != null) {
for (int i = 0; i < listSumCreate.size(); i++) {
Object map = listSumCreate.get(i);
for (int m = 0; m < headerArray.length; m++) {
// 获得方法
Method dataKey = headerKeyArray.get(m);
Object content = dataKey.invoke(map);
if (content != null) {
Label label = new Label(
m,
i + 2,
String.valueOf(content),
c.getDataCellFormat(CellType.STRING_FORMULA));
sheet.addCell(label);
}
}
}
}
} catch (Exception e) {
log.error("导出数据出现异常:", e);
}
sheet.setColumnView(0, 30); // 设置列的宽度
sheet.setColumnView(1, 30);
String cityName="PDUCI持续集成";
c.PrintExcel(sheet, wwb, fileName,cityName);
} catch (Exception e) {
System.out.println("---出现异常---");
e.printStackTrace();
}
}
try {
CreateExcel c=new CreateExcel();
int filei=0;
// list中存放的对象的class
String className = "com.huawei.sdmp.data.ProjectVessionScore";
// 表头
String[] headerArray = null;
// 需要执行的方法对象
List<Method> headerKeyArray = getMethods(className, headerDataKey);
// 替换掉所有的<br/>换行符
header = header.replaceAll("</br>", "");
if (StringUtils.isNotBlank(header))
headerArray = StringUtils.split(header, ",");
String[] select = { "开始时间:" + startTime, "结束时间:" + endTime };
List<?> listSumCreate=(List<?>)getRequest().getSession().getAttribute("listSumCreate");
String fileName = System.getProperty("java.io.tmpdir")+"\\xls"+(new java.util.Date().getTime())+(filei++);
WritableWorkbook wwb = Workbook.createWorkbook(new File(fileName));
// 添加第一个工作表并设置第一个Sheet的名字
WritableSheet sheet = wwb.createSheet("PDUCI持续集成", 0);
try {
c.CraeateExce(select, headerArray, sheet);
if (listSumCreate != null && headerKeyArray != null && headerArray != null) {
for (int i = 0; i < listSumCreate.size(); i++) {
Object map = listSumCreate.get(i);
for (int m = 0; m < headerArray.length; m++) {
// 获得方法
Method dataKey = headerKeyArray.get(m);
Object content = dataKey.invoke(map);
if (content != null) {
Label label = new Label(
m,
i + 2,
String.valueOf(content),
c.getDataCellFormat(CellType.STRING_FORMULA));
sheet.addCell(label);
}
}
}
}
} catch (Exception e) {
log.error("导出数据出现异常:", e);
}
sheet.setColumnView(0, 30); // 设置列的宽度
sheet.setColumnView(1, 30);
String cityName="PDUCI持续集成";
c.PrintExcel(sheet, wwb, fileName,cityName);
} catch (Exception e) {
System.out.println("---出现异常---");
e.printStackTrace();
}
}