我正在尝试使用Apache POI读取xlsx文件,但是当我调用方法WorkbookFactory.create时,它没有响应,也没有抛出异常。该文件不是那么大(40Mb)。
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import junit.framework.Assert;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.junit.Test;
public class DiversTest {
@Test
public void testLectureFichierExcel() throws EncryptedDocumentException, InvalidFormatException, IOException{
File fichierSuivi = new File("in/resources/test.xlsx");
InputStream inputXLS = new FileInputStream(fichierSuivi);
Workbook workbook = WorkbookFactory.create(inputXLS);
Assert.assertTrue(true);
}
}
任何帮助都将不胜感激。