如何将数据从excel导入到jTable? [英] how to import datas from excel to jTable?
本文介绍了如何将数据从excel导入到jTable?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JFileChooser fc = new JFileChooser();
int option = fc.showSaveDialog(NewJFrame1.this);
if(option == JFileChooser.APPROVE_OPTION){
String filename = fc.getSelectedFile().getName();
String path = fc.getSelectedFile().getParentFile().getPath();
int len = filename.length();
String ext = "";
String file = "";
if(len > 4){
ext = filename.substring(len-4, len);
}
if(ext.equals(".xls")){
file = path + "\\" + filename;
}else{
file = path + "\\" + filename + ".xls";
}
toExcel(jTable1, new File(file));
}
这是我将表保存到excel的方式,它可以正常工作,但是我想在重新启动程序后导入这些数据,有人可以帮我吗?
this is how i save my table to excel it works fine but i want to import these datas after i restart my program can someone help me about this ?
推荐答案
//下载并插入
这篇关于如何将数据从excel导入到jTable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文