目前导出是成功了 但是输出流还不会耍 目前指定了文件输出路径 怎么把路径改成弹出一个框然后选择输出的位置?
HSSFWorkbook wb = new HSSFWorkbook();
FileOutputStream fout = new FileOutputStream("E:/students.xls");
wb.write(fout);
fout.close();
用下面的代码选定路径就可以了
JFileChooser fileChooser = new JFileChooser("D:\\");
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = fileChooser.showOpenDialog(fileChooser);
if (returnVal == JFileChooser.APPROVE_OPTION) {
String filePath = fileChooser.getSelectedFile().getAbsolutePath();
}
import java.io.FileOutputStream;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.List;import org.apache.poi.hssf.usermodel.HSSFCell;import org.apache.poi.hssf.usermodel.HS......
答案就在这里:java如何把数据导出成excel
----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。