Hi,
I try to build a simple Excel document using Apache POI library in a Groovy script which is executed by a Script Report. I try to use the object net.datenwerke.rs.core.service.reportmanager.engine.basereports.CompiledXlsxReport for which I have unfortunately no API. My output is an ObjectOutputStream or a FileOutputStream but I cannot provide them to the CompiledXlsxReport class.
Do you have a simple functioning example in this respect?
Many thanks in advance.
Cristian
Hi Christian,
ReportServer CE sources and apidoc can be found here
In most cases it should be sufficient as a help in scripting.
Below is a fragment of a script that I use:
/* create POI Workbook */
def excel2008 = true
def wb = null
if(! excel2008) {
wb = new HSSFWorkbook();
} else {
wb = new XSSFWorkbook();
}
// your code here
// when you are ready with the workbook, then:
/* generate bos */
def bos = new ByteArrayOutputStream()
wb.write(bos)
/* get bytes and close stream */
def result = new CompiledXlsxReport(bos.toByteArray())
bos.close()
return result
Hope it helps.
Karolina
Hi Karolina,
Many thanks for the info and for your script. This is exactly what I needed, it is running just fine.
Greetings,
Cristian