我正在创建一个java程序来读取excel表并创建一个逗号分隔文件.当我运行带有空白列的示例excel文件时,第一行工作正常,但其余行跳过空白单元格.我已经阅读了将空白单元格插入行所需的代码更改,但我的问题是为什么第一行有效?
public ArrayList OpenAndReadExcel(){
FileInputStream file = null;
HSSFWorkbook workBook = null;
ArrayList <String> rows = new ArrayList();
//open the file
try {
file = new FileInputStream(new File("Fruity.xls"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("Could not open Input File");
e.printStackTrace();
}
// open the input stream as a workbook
try {
workBook = new HSSFWorkbook(file);
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Can't Open HSSF workbook");
e.printStackTrace();
}
// get the sheet
HSSFSheet …Run Code Online (Sandbox Code Playgroud) apache-poi ×1