I would like to do Excel Export in the file format of XLSX. I have chosen Apache POI OOXML 3.9 (without excel installed on server). I see Excel export with the file format xls (HSSF) works well with LS2J. But XSSF not works.
I am using following Jar 1) poi 2) poi-ooxml 3) dom4j 4) poi--ooxml-schemas 5) XML beans
I have existing business logic which is written in lotus script, so i want to expose Excel export(Java) via LS2J. But i keep getting following error
Threw java.lang.ExceptionInInitializerError
Source code:- package com.clr.oocmlexcel;
import java.io.File; import java.io.FileOutputStream;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ExcelWriter {
public boolean writeExcelHeader(Object rowValues) {
try {
XSSFWorkbook workbook = new XSSFWorkbook();
FileOutputStream out = new FileOutputStream(new File("C:\\temp\\howtodoinjava_demo.xlsx"));
workbook.write(out);
out.close();
return true;
} catch(Exception ex) {
ex.printStackTrace();
return(false);
}
}
}
Lotus Agent code:- Option Public Option Declare UseLSX "*javacon"
Use "OOOXMLExcelWriter"
Sub Initialize On Error GoTo ErrorHandler Dim js As JAVASESSION Dim xlWriterClass As JAVACLASS Dim xlWriterObject As JavaObject
Set js = New JAVASESSION
Set xlWriterClass = js.GetClass("com.clr.oocmlexcel.ExcelWriter")
Set xlWriterObject = xlWriterClass.CreateObject
If(Not(xlWriterObject.writeExcelHeader()))Then
Print "Error creating excel sheet!"
Exit Sub
End If
End Sub
When i try to use the same functionality with Java Agent i able to achieve but LS2J not helps.
Can you please help me someone?