xlsx:
-, jar:
- dom4j-2.1.0.jar
- -3.17.jar
- -OOXML-3.17.jar
- -collections4-4.1.jar
- XMLBeans-2.3.0.jar
-, :
import org.apache.poi.ss.usermodel.*;
import java.io.File;
import java.io.IOException;
import java.io.FileInputStream;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-, , , :
public void ReadExcelFiles(String pathxlsx,javax.swing.JTable jtable) throws IOException{
File file = new File(pathxlsx);
FileInputStream fis = new FileInputStream(file);
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sh = wb.getSheetAt(0);
System.out.println(sh.getLastRowNum());
System.out.println("Name: "+sh.getSheetName());
Row row = sh.getRow(6);
System.out.println(row.getRowNum());
System.out.println("columna "+row.getCell(1).getStringCellValue());
System.out.println("columna "+row.getCell(2).getStringCellValue());
System.out.println("columna "+row.getCell(3).getStringCellValue());
System.out.println("columna "+row.getCell(4).getStringCellValue());
System.out.println("Val: "+sh.getRow(4).getCell(6).getStringCellValue());
}