Announcement

Migration of this forum

Dear users of this forum,

we are pleased to inform you that we will be updating the software behind this forum in the near future.

Existing posts, users and categories will remain untouched.

Important:

  • Each user will need to reset their password.
  • Please select "I forgot my password".
  • Enter the email address you used to register in this forum.
  • You will receive an email with a link to set a new password.
  • Please choose a new (secure) password and confirm the process.

We will keep you informed in the pinned thread.

Kind regards,
Your ReportServer Team


Migration des Forums

Liebe Nutzer dieses Forums,

wir freuen uns, euch mitteilen zu können, dass wir in naher Zukunft die Software hinter diesem Forum aktualisieren werden.

Existierende Beiträge, Nutzer und Kategorien bleiben weiterhin bestehen!

Wichtig:

  • Jeder Nutzer muss sein Passwort neu vergeben.
  • Wählt dazu einfach "Ich habe mein Passwort vergessen".
  • Gebt die E-Mail-Adresse ein, mit der ihr registriert seid.
  • Ihr erhaltet eine E-Mail mit einem Link zur Passwortvergabe.
  • Bitte wählt ein neues (sicheres) Passwort und bestätigt den Vorgang.

Wir halten euch im angepinnten Beitrag auf dem Laufenden!

Mit vielen Grüßen
Euer ReportServer Team

#1 2016-06-17 12:56:42

cchris26
Member
From: Munich
Registered: 2016-05-09

Generating Excel from Script Report

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

Offline

#2 2016-06-17 15:49:04

karolina
Member
Registered: 2014-08-09

Re: Generating Excel from Script Report

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

Offline

#3 2016-06-20 09:05:19

cchris26
Member
From: Munich
Registered: 2016-05-09

Re: Generating Excel from Script Report

Hi Karolina,

Many thanks for the info and for your script. This is exactly what I needed, it is running just fine.

Greetings,
Cristian

Offline

Board footer

Powered by FluxBB