java 使用java在JTable中导入excel文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16748077/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 23:52:10  来源:igfitidea点击:

import excel file in JTable using java

javaswingexceljtablejfilechooser

提问by Brainser

I want that when button is clicked using JFileChooser, filedialogneed to be opened and when excel file is selected it need to be loaded in JTablecan anyone please help how to import excel file into jtable?

我希望在使用按钮时JFileChooserfiledialog需要打开,选择Excel文件时需要加载JTable任何人请帮助如何将Excel文件导入jtable

采纳答案by Alpesh Gediya

Here are some use useful links/tutorial for you to use.

这里有一些有用的链接/教程供您使用。

Importing Excel (.xls) in Java Swing application

在 Java Swing 应用程序中导入 Excel (.xls)

blog

博客

There are a couple of open source libraries which you can use to read an excel file such as Apache POI.

有几个开源库可用于读取 excel 文件,例如Apache POI。

Once you've read your excel file into some data structure, this can be written into a DataModelfor a JTable. Alternatively, you could write a custom DataModelwhich will read dynamically from the excel file, but I'd take the two steps separately and build up the complexity once you understand the excel file reading library you choose.

一旦您将 excel 文件读入某种数据结构,就可以将其写入 a DataModelfor a JTable。或者,您可以编写一个自定义DataModel来从 excel 文件中动态读取,但是一旦您了解了您选择的 excel 文件读取库,我将分别执行这两个步骤并建立复杂性。