所以我收到错误消息,因为XSSFWorkbook导入似乎与最后一行不兼容。代码原样给出错误消息“org.apache.poi.xssf.usermodel.XSSFWorkbook”包不存在。当我删除导入时,最后一行然后得到我应该创建一个XSSFWorkbook类的错误消息。我目前正在使用Apache 3.7 utilmodel文件来导入XSSFWorkbook类。非常感激任何的帮助。我正在尝试创建一个从excel文件中读取数据的程序。
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ReadExcel {
private static final String FILE_PATH =
"/Users/riveraaz/Desktop/FantasyPros_2015_Overall.numbers";
public static List getPlayersFromExcel() {
List PlayerList = new ArrayList();
FileInputStream fis = null;
try {
fis = new FileInputStream(FILE_PATH);
Workbook workbook = new XSSFWorkbook(fis);