我在將 XLS 數(shù)據(jù)導(dǎo)入 jtable 時(shí)遇到問題。我的程序只讀取 XLS 的最后一行。這是我的代碼:JButton btnImportExcelFiles = new JButton("EXCEL FILES");btnImportExcelFiles.setIcon(new ImageIcon(racunariAplikacija.class.getResource("/image/Excel-icon.png")));btnImportExcelFiles.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent arg0) { FileFilter filter = new FileNameExtensionFilter("Excel Files", "xls"); // here is my file chooser JFileChooser jf = new JFileChooser(); jf.addChoosableFileFilter(filter); int rezultat = jf.showOpenDialog(null); if(rezultat == JFileChooser.APPROVE_OPTION) { String excelPath = jf.getSelectedFile().getAbsolutePath(); ArrayList<Stavka>lista = new ArrayList<>(); Stavka stavka = new Stavka(); File f = new File(excelPath); Workbook wb = null; try { wb = Workbook.getWorkbook(f); } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // this is where i call for nested forloop Sheet s = wb.getSheet(0); int row = s.getRows(); int col = s.getColumns(); System.out.println("redovi" + row + "kolone" + col);如何解決這個(gè)問題?
如何將xls文件讀入jtable
慕工程0101907
2021-06-22 14:06:36