最近做个导出Excel表格的功能,(保存到固定写死的目录是可以的)但怎么才能选择导出保存的路径,就类似这样的:
我用的是 POI的jar包
文件输出代码:
// 输出Excel文件
OutputStream output = null;
//FileOutputStream output = null;
try {
output = response.getOutputStream();
response.reset();
response.setHeader("Content-disposition", "attachment; filename=details.xls");
response.setContentType("application/x-download");
wb.write(output);
// output=new FileOutputStream("d:\\"+ System.currentTimeMillis()+".xls");
// wb.write(output);
// output.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (output != null) {
try {
output.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}