WritableWorkbook wwb = null;
WritableSheet ws = null;
OutputStream OS = response. getOutputStream ();
Wwb = Workbook. createWorkbook (OS );
Ws = wwb. createSheet ("employee ID", 0 );
Ws. getSettings (). setdefacolumcolumnwidth (15 );
Ws. setColumnView (0, 20 );
Ws. setColumnView (1, 20 );
Ws. setColumnView (2, 80 );
Label label = new Label (, "date"); // column row name
Ws. addCell (label );
Label = new Label (1, 0, "salary ");
Ws. addCell (label );
Label = new Label (2, 0, "increase ");
Ws. addCell (label );
Response. setContentType ("application/vnd. ms-excel ");
Response. setHeader ("Content-disposition", "attachment; filename =" + new String (titlename ). getBytes ("gbk"), "iso8859-1") + ". xls ");
If (null! = Pro_List & pro_List.size ()> 0 ){
Map oneMap = null;
For (int I = 0; I <pro_List.size (); I ++ ){
OneMap = pro_List.get (I );
Label = new Label (0, (I + 1), CommonString. getFormatPara (oneMap. get ("date ")));
Ws. addCell (label );
Label = new Label (1, (I + 1), CommonString. getFormatPara (oneMap. get ("money ")));
Ws. addCell (label );
Label = new Label (2, (I + 1), CommonString. getFormatPara (oneMap. get ("amplification"). equals ("")? "0": CommonString. getFormatPara (oneMap. get ("amplification") + "% ");
Ws. addCell (label );
}
}
Wwb. write ();
Wwb. close ();
OS. close ();
OS = null;
Response. flushBuffer ();
Out. clear ();
Out = pageContext. pushBody ();
Share: