자바 엑셀 여러 시트 내 보 내기 (sheet 여러 개 추가)
// excel
WritableWorkbook wwb = null;
try {
// Workbook (Workbook)
wwb = Workbook.createWorkbook(new File(fileName));
} catch (IOException e) {
log.error(e);
}
long totle = service.getTotle(searchParameters);// , , excel
// 65536
float res=Float.parseFloat(String.valueOf(totle));
float mus=65536;
float avg=res/mus;
Map cols = (Map) request.getSession().getAttribute("columnsMap"); //
for (int i = 0; i < avg+1; i++) {
searchParameters.setEvent_id(String.valueOf(i*mus)); //
searchParameters.setTotalLimit(String.valueOf((i+1)*mus));//
List result = service.getEvents(searchParameters); //
if(wwb!=null){
//
//Workbook createSheet , ,
WritableSheet ws = wwb.createSheet(" "+(i+1), i);
String colss = ((String) cols.get("cols")).substring("selected"
.length() + 1);
String[] columns = colss.split(","); // ( )
String[] colNames = ((String) cols.get("colNames")).split(",");
for (int j = 0; j < columns.length; j++) {
jxl.write.WritableFont wfc = new jxl.write.WritableFont(WritableFont.ARIAL,10,WritableFont.NO_BOLD,false,jxl.format.UnderlineStyle.NO_UNDERLINE,jxl.format.Colour.BLACK);
jxl.write.WritableCellFormat wcfFC = new jxl.write.WritableCellFormat(wfc);
wcfFC.setBackground(Colour.GRAY_25);
Label label = new Label(j, 0,colNames[j],wcfFC);
ws.setColumnView(j, 20); //
ws.addCell(label); //
}
String str="";
//
for(int m=0;m 직접 코드: