我目前正在使用Apache POI解析PPTX文档,并能够从PPT幻灯片XSLFSlide中提取图像,嵌入式OLE对象,但不知道如何从幻灯片中提取嵌入式xls表。我需要帮助尝试解析和读取嵌入式xls表在PPT幻灯片。
gab6jxml1#
try (FileInputStream inStream = new FileInputStream(new File("path/to/file.xlsx"))) { XSSFWorkbook workbook = new XSSFWorkbook(inStream); XSSFSheet sheet = workbook.getSheetAt(0); for (Iterator<Row> rowIterator = sheet.iterator() ; rowIterator.hasNext(); ) { Row row = rowIterator.next(); for (Iterator<Cell> cellIterator = row.cellIterator(); cellIterator.hasNext(); ) { Cell cell = cellIterator.next(); switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: System.out.print(cell.getNumericCellValue() + "t"); break; case Cell.CELL_TYPE_STRING: System.out.print(cell.getStringCellValue() + "t"); break; ... } } System.out.println(""); } }
字符串
1条答案
按热度按时间gab6jxml1#
字符串