作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
public String readExcel(String columnname,String UserType) {
try {
FileInputStream file = new FileInputStream(path);
@SuppressWarnings("resource")
XSSFWorkbook wr = new XSSFWorkbook(file);
XSSFSheet sh = wr.getSheet(prop.getProperty("env"));
int row = sh.getPhysicalNumberOfRows();
System.out.println(row);
for(int j=0;j<row;j++) {
if((sh.getRow(j).getCell(1).getStringCellValue()).equalsIgnoreCase(UserType)) {
for(int i=0;i<row;i++) {
String s=sh.getRow(0).getCell(i).getStringCellValue();
if(s.equals(columnname)) {
value = sh.getRow(0).getCell(i).getStringCellValue();
}
}
}
}
}catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
return value;
}
public static void main(String args[]) {
Util obj=new Util();
obj.readExcel("Username","Testuser1");
}
java.lang.IncompatibleClassChangeError: Found interface org.apache.poi.util.POILogger, but class was expected
中出现异常.
最佳答案
将此添加到您的 pom.xml 文件中
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>x.x.x</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>x.x.x</version>
</dependency>
关于java - 找到接口(interface) org.apache.poi.util.POILogger,但预期类错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58147646/
public String readExcel(String columnname,String UserType) { try { FileInputStre
我在使用 apache poi 依赖项时遇到以下错误。 org.springframework.web.util.NestedServletException: Handler dispatch fa
您好,我第一次尝试使用 apache.poi 将 xlsx 转换为 pdf,它工作得很好,直到我添加一些需要使用 3.17 版本的代码(将 docx 转换为 pdf)。之后,当我尝试转换 xlsx 时
过去一周我一直在从事一个工作项目,但由于不断收到错误,我陷入了困境。我想知道是否有人可以帮助我。 我已附上我创建的两个文件以及我收到的错误。如果有人能告诉我如何修复该错误,我将不胜感激 我正在使用 e
我已经使用 apache poi 完成了 Excel 工作表的读取和写入。但是如果我尝试使用相同的 apache poi 下载 ms-word,则会抛出以下错误。java.lang.IllegalAc
我是一名优秀的程序员,十分优秀!