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");
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");