Hi,
I encountered an error “java.lang.reflect.InvocationTargetException” when opening “.xlsx” file using Apache POI 3.10, but no problem opening “.xls” file.
I have the Java class codes in the Script library and called the class in LotusScript agent.
The jar I used:
-dom4j-1.6.1.jar
-poi-3.10-FINAL-20140208.jar
-poi-ooxml-3.10-FINAL-20140208.jar
-poi-ooxml-schemas-3.10-FINAL-20140208.jar
-poi-scratchpad-3.10-FINAL-20140208.jar
-stax-api-1.0.1.jar
-xmlbeans-2.3.0.jar
Sample code for opening file:
…
public class ExcelReader{
Public boolean openExcelFile
{
…
//For xls file
fs = new NPOIFSFileSystem(new File(fileName));
wb = new HSSFWorkbook(fs.getRoot(),true);
…
//For xlsx file
fsx = OPCPackage.open(new File(fileName));
wbx = new XSSFWorkbook(fsx);
}
}
…
Sample code calling in LotusScript agent:
…
Set js = New JAVASESSION
Set xlReaderClass = js.GetClass(“Excel.ExcelReader”)
Set xlReaderObject = xlReaderClass.CreateObject
isOpen = xlReaderObject.openExcelFile(fileName)
…
Do you have any idea how to resolve this issue for Lotus Notes?
Regards,
Budz