How do I make XLS of this?

By: Kjetil T. - kjetolle
How do I make XLS of this?
2003-06-24 05:35
Hi, all!
I'm still trying to convert an existing report into XLS format. Below are the basic code elements of my report. The point is that this report works fine, but when I try to use the code samples for converting/filling to XLS, the whole thing stops.
As you probably notice, this report creates a PDF file, and I'm using a JRBeanCollectionDataSource instead of a Connection.
An object of this report is made from my UI with
"TestReport report = new TestReport(date_1, date_2)

public class TestReport{
public static final String REPORT_NAME = "/reports/TestReport.xml";
public static final String PDF_FILE_NAME = "H:/TestReport.pdf";

JasperReport jasperReport = null;
java.sql.Date start;
java.sql.Date stop;

public TestReport(java.sql.Date startDate, java.sql.Date stopDate) {
start = startDate;
stop = stopDate;


public TestReport(String reportName) {
InputStream in = TestReport.class.getResourceAsStream(reportName);
if (in == null) {
throw new IllegalArgumentException("Can't find report " + reportName);

try {

jasperReport = JasperCompileManager.compileReport(in);
} catch (JRException jre) {
throw new IllegalStateException("Error while compiling report: " + jre);

public void fillReport() throws EjbHomeFactoryException, javax.ejb.CreateException, javax.ejb.FinderException,
java.rmi.RemoteException {

Map parameters = new HashMap();
parameters.put("periode", start + " - " + stop);
try {
EjbHomeFactory ejbHomeFactory = EjbHomeFactory.getFactory();

// In this section I create a collection from JBoss/EJB
// skipping the EJB setup code.....
List collector = new ArrayList();
List reportCollection = (ArrayList)workFlow.findEJBInfo(start, stop);
MyEJB.EJBInfo ejbInfo = new MyEJB.getInfo();
for (int j = 0; j < reportCollection.size(); j++) {
ejbInfo = (MyEJB.EJBInfo) reportCollection.get(j);

JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters,
new JRBeanCollectionDataSource(collector));


JasperViewer.viewReport(jasperPrint, false);

} catch (JRException jre) {
throw new IllegalStateException("Can't fill report:" + jre);
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 13 years 3 months ago

0 Answers:

No answers yet