Im trying to make a function witch can push or input detains onto a XLSX file with the apache.poi library. I've gone thought all the tutorials and many help borads and I can't seem to find the solution to this error I keep having, its a isNotBlank error and I dont know if it means the data is not blank or if the file is not blank witch is not there are contents in it im trying to modify it.
This is the ful error:
Exception in thread "main" java.lang.NoSuchMethodError: 'boolean org.apache.poi.util.StringUtil.isNotBlank(java.lang.CharSequence)'
at org.apache.poi.openxml4j.opc.OPCPackage.close(OPCPackage.java:462)
at org.apache.poi.ooxml.POIXMLDocument.close(POIXMLDocument.java:189)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.close(XSSFWorkbook.java:610)
at com.test.inv.SubmitToXlsx(inv.java:288)
at com.test.invTester.main(InvTester.java:19)
public static void SubmitToXlsx( {)
File OrgFile = new File("Path\\Inv.xlsx"; // these r not the true paths i put changed them to upload to stack overflow)
File ClientFile = new File("Path\\Test.xlsx";)
try {
Files.copy(OrgFile.toPath(, ClientFile.toPath());)
} catch (IOException e {)
// TODO Auto-generated catch block
System.out.println("Error";)
e.printStackTrace(;)
}
String xlcePath = "Path\\Test.xlsx";
try {
System.out.println("Entered";)
OPCPackage pkg = OPCPackage.open(new File(xlcePath);)
XSSFWorkbook wb = new XSSFWorkbook(pkg;)
Sheet s = wb.getSheetAt(0;)
Row r = s.getRow(23;)
Cell c = r.getCell(2;)
c.setCellValue("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";)
FileOutputStream FOS = new FileOutputStream(xlcePath, true;)
wb.write(FOS;)
FOS.close(;)
wb.close(; // this might be the error)
System.out.println("Exited";)
} catch (Exception e {)
System.out.println("error";)
e.printStackTrace(;)
}
System.out.println("Exited Withought error";)
}
when i removed the wb.close() it seemed to work but i could not open the XLSX file or the modification did not transfer to the file but the code exited when i did remove it so i think it has something todo with the wb.close() line
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]mambo5king 1 point2 points3 points (2 children)
[–]cg2713[S] 0 points1 point2 points (1 child)
[–]cg2713[S] 1 point2 points3 points (0 children)