1、jxl包(JAVA EXCEL API)。
2、poi包(Jakarta POI API ),apache的開源包。
3、iText包,對pdf處理很好。
4、當然,有興趣你可以自己寫。
用過jxl,和使用數據庫的ResultSet差不多。
另:
在線打開Excel
try{
File f = new File(path);
BufferedInputStream br = new BufferedInputStream(new FileInputStream(f));
byte[] buf = new byte[1024];
int len = 0;
response.reset(); //非常重要
response.setContentType("application/vnd.ms-excel");
OutputStream outStream = response.getOutputStream();
while((len = br.read(buf)) >0)
outStream.write(buf,0,len);
br.close();
outStream.close();
}catch(Exception e){
e.printStackTrace();
out.println("下載打開出錯");
return ;
}
下載用SmartUpload 包
SmartUpload su = new SmartUpload();
su.initialize(config, request, response);
su.setContentDisposition(null);
su.downloadFile(path, "", fileTitle+".xls");
Excel生成和讀取(原創)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
jackson官方快速入門文檔
官方地址: http://jackson.codehaus.org/ http://wiki.fasterxml.com/JacksonInFiveMinutes
天魂地煞
2020-06-21 20:11:38
logback配置詳解1
天魂地煞
2020-02-23 12:52:03
Jackson將json字符串轉換成泛型List
天魂地煞
2020-02-23 12:51:53
上傳下載--jspmarkupload(轉載)
hqenco
2018-08-26 03:49:37
類的動態調用和表達式求值(原創)
hqenco
2018-08-26 03:49:34