用poi保存为excel文件

Posted on 2007-09-20 14:54 angel 阅读(741) 评论(0)  编辑  收藏
 1 OutputStream fos = res.getOutputStream();
 2HSSFWorkbook wb = new HSSFWorkbook();
 3HSSFSheet s = wb.createSheet();
 4wb.setSheetName(0"Matrix");  
 5
 6for(int i=0; i<5; i++{
 7
 8HSSFRow row = s.createRow(i);
 9HSSFRichTextString ss = new
10      HSSFRichTextString("aa");
11      cell.setCellValue(ss);
12              
13 }

14//写出EXCEL
15try {
16            fos.flush();
17            wb.write(fos);
18
19        }
 catch (IOException e) {
20            e.printStackTrace();
21        }

22

只有注册用户登录后才能发表评论。


网站导航:
 

Copyright © angel