亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何將xls文件讀入jtable

如何將xls文件讀入jtable

慕工程0101907 2021-06-22 14:06:36
我在將 XLS 數據導入 jtable 時遇到問題。我的程序只讀取 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);如何解決這個問題?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 198 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號