嗨,我正在尝试在 XSSFWorkBook 的帮助下使用 FlatFileReader 读取 xlsx 文件,但是使用 XSSFWorkBook 读取很好,但是在尝试使用 FlatFileReader 读取工作表时我们无法读取。代码如下所示,请查看
String fileName = "E:\\LLS-6192013-42631.csv";
File file = new File(fileName);
FileSystemResource fsr = new FileSystemResource(fileName);
XSSFWorkbook workbook = new XSSFWorkbook(fileName);
int sheetIndex = 0;
XSSFSheet sheet = workbook.getSheetAt(sheetIndex);
//System.out.println("sheet content : " + sheet);
ApplicationContext appContext = new ClassPathXmlApplicationContext(
"classpath:/launch-context.xml");
@SuppressWarnings("rawtypes")
FlatFileItemReader flatFileItemReader = (FlatFileItemReader) appContext
.getBean("redemptionReader");
flatFileItemReader.setResource(resource);
如何使用 FlatFileReader 读取 xlsx 文件?