我正在尝试使用 Apache POI 读取 XLSX 文件,但我无法读取该文件。我收到以下代码的错误:
A sheet hyperlink must either have a location, or a relationship
请帮我查明我哪里出错了:
public void readFile() throws Exception {
String filePath="/home/work1/DATA FEB/MANI-FINAL/ENGG-1.xlsx";
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(filePath));
sheet = workbook.getSheetAt(0);
}
这是堆栈跟踪:
Exception in thread "main" java.lang.IllegalStateException: A sheet hyperlink must either have a location, or a relationship. Found:
<xml-fragment ref="J502:J503" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"/>
at org.apache.poi.xssf.usermodel.XSSFHyperlink.<init>(XSSFHyperlink.java:72)
at org.apache.poi.xssf.usermodel.XSSFSheet.initHyperlinks(XSSFSheet.java:182)
at org.apache.poi.xssf.usermodel.XSSFSheet.read(XSSFSheet.java:139)
at org.apache.poi.xssf.usermodel.XSSFSheet.onDocumentRead(XSSFSheet.java:119)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.onDocumentRead(XSSFWorkbook.java:222)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:200)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:179)