I’m trying to call a method(getSheetAt) of XSFFWorkbook class to read excel files but its throwing overload matches error in peoplesoft. To get around this issue, I’ve tried using Java reflection concept but it doesn’t seem to work.. Can somebody please help. Thanks
Local JavaObject &workbook = CreateJavaObject(“org.apache.poi.xssf.usermodel.XSSFWorkbook”);
Local JavaObject &class = &workbook.getClass();
Local JavaObject &javaInteger = CreateJavaObject(“java.lang.Integer”, 1);
Local JavaObject &intType = CreateJavaObject(“java.lang.Class[]”, &javaInteger.TYPE);
Local JavaObject &createSheet = &class.getDeclaredMethod(“getSheetAt”, &intType);
Local JavaObject &args = CreateJavaObject(“java.lang.Object[]”, 0);
Local JavaObject &sheet = &createSheet.invoke(&workbook, &args);
The expectation is to call the method getsheetAt and get the return object of type XSSFSheet .
Ram is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.