Supports: XLS (HSSF), XLSX (XSSF), Word (HWPF), powerpoint (HSLF), and Visio (HDGF) read and write

poi

poi.apache.org/

A workbook, a sheet, a column, a cell

@Test public void test1() throws IOException { Workbook workbook = new HSSFWorkbook(); Sheet sheet = workbook.createSheet(); Row row = sheet.createRow(0); Cell cell = row.createCell(0); Cell.setcellvalue (" first row, first cell "); Row row2 = sheet.createRow(1); Cell row2cell1 = row.createCell(0); Cell.setcellvalue (" first cell in row 2 "); FileOutputStream fileOutputStream = new FileOutputStream("f:/1.xls"); workbook.write(fileOutputStream); fileOutputStream.close(); } @Test public void test2() throws IOException { FileInputStream fileInputStream = new FileInputStream("f:/1.xls"); Workbook workbook = new HSSFWorkbook(fileInputStream); Sheet sheet = workbook.getSheetAt(0); Row row = sheet.getRow(0); Cell cell = row.getCell(0); System.out.println(cell.getStringCellValue();) ; fileInputStream.close(); }Copy the code

easyExcel

alibaba-easyexcel.github.io/