At this point you're in the realm of JasperReports. Admittedly, their user forums suck in comparison to Wicket, but you may find your answer about the Excel issue there or on the POI user list (if it exists).
-----Original Message----- From: Jim Pinkham [mailto:[email protected]] Sent: Tuesday, January 18, 2011 2:00 PM To: [email protected] Subject: Re: JasperReport viewing options for wicket 1.5 ... and to follow up briefly - I got past the class not found by adding: <!-- this should be redundant?? --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.2-FINAL</version> </dependency> (Although even then, mvn eclipse:eclipse didn't add it - I had to add it myself to the classpath! - perhaps because it's declared as "optional" in the projects's pom.xml ? wierd.) So now I can click on my link and download an XLS, but then I get this lovely message: Excel found unreadable content in 'report1xls'. Do you want to recover the contents... OK sure... then: 'Damage to the file was so extensive that repairs were not possible. ...etc'. The resulting workbook that finally opens looks like it's ok at first, then all messed up starting a few pages down where a string value contains an ampersand (It's possible the data has some HTML like &). To say that I'm out of my element here is an understatement. If I don't get any better ideas, I'll go with this hack (notice I switch to using the HTML exporter): private static IJRResourceHandler fixXls(IJRResourceHandler handler) { // kludge for xls if (handler instanceof XlsResourceHandler) { return new XlsResourceHandler() { private static final long serialVersionUID = 1L; @Override public JRAbstractExporter newExporter() { JRAbstractExporter exporterXLS = new JRHtmlExporter(); exporterXLS.setParameter(JRXlsAbstractExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); exporterXLS.setParameter(JRXlsAbstractExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); exporterXLS.setParameter(JRXlsAbstractExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.TRUE); exporterXLS.setParameter(JRXlsAbstractExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); return exporterXLS; } }; } return handler; } But it makes all kinds of ugly dead image links every other row and column around the data. Yuck. Any other jasper users want to share any tips here? Thanks, -- Jim. On Tue, Jan 18, 2011 at 2:17 PM, Jim Pinkham <[email protected]> wrote: > Well, I seem to be making good progress, but still not 100% there. > > I got "git" and did a clone of wicketstuff and built jasperreports and > added it's target\jar to my local repo. > I only had to change the core's pom.xml to refer to the 1.5-M3 version I'm > using instead of 1.5-SNAPSHOT. > > So far so good - pdf reports work fine (hooray) but now XLS is giving me > this: > > NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFCellStyle > > Also, while I'm at it, maybe this saves someone else a bit of effort - > > I had to add a log4j dependency to the jasperreports-maven-plugin as > described in the final post here: > > http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=63750 > > And here's how I'm using it: > > public class ReportResource extends JRConcreteResource<IJRResourceHandler> > { > > public ReportResource(final String report, final IJRResourceHandler > handler, final Map<String,Object> params) { > super(new File(ReportResource.class.getClassLoader() > .getResource(report+".jasper").getFile()), > fixXls(handler)); > > setReportParameters(params); > setFileName(report+handler.getExtension()); > setConnectionProvider(new IDatabaseConnectionProvider() { > private static final long serialVersionUID = 1L; > public Connection get() { > try { > // If I hold on to conn reference here I get > serializable problems > return > MyApplication.get().getConnectionForCurrentDatabase(); > } catch (SQLException e) { > return null; > } > } > public void release() {} // should I be doing conn.close? > }); > } > } > > And then here's how I use it: > add(new ResourceLink<Void>("testPdf", new ReportResource("report1", > new PdfResourceHandler(), params))); > add(new ResourceLink<Void>("testXls", new ReportResource("report1", > new XlsResourceHandler(), params))); > > So I think it's just a missing dependency someplace... anyone got a tip for > me? (ideally, how I can find it myself rather than mooch) > > Any advice would be most welcome! > > Thanks, > -- Jim. > > > On Tue, Jan 18, 2011 at 8:59 AM, Martin Grigorov <[email protected]>wrote: > >> You'll need to build it yourself locally. >> There is not yet a release of wicketstuff-1.5 at oss.sonatype.org. I >> think >> we will release it once Wicket 1.5-RC1 is released (hopefully this week). >> >> On Tue, Jan 18, 2011 at 2:48 PM, Jim Pinkham <[email protected]> wrote: >> >> > Thanks - so glad to see it's been ported to 1.5; now, I need the jar. >> > >> > Maven gives me: >> > Unable to find resource 'org.wicketstuff:jasperreports:pom:1.5-SNAPSHOT' >> in >> > repository public (http://public) >> > .. and then again for 2 repositories I tried adding: wicket-snaps, and >> > nonatype-nexus-snapshots at >> > <url>http://wicketstuff.org/maven/repository</url> >> > and >> > <url>http://oss.sonatype.org/content/repositories/snapshots >> > </url> >> > >> > Am I missing a new repository since the move to GIT ? Everything else >> > (wicket, wicket-extensions, wicket-datetime, wicket-auth-roles, >> > mysql-connectory-java, commons-dbcp, spring, jasperreports, ehcache, >> jetty >> > ...etc works OK. ?? >> > >> > Perhaps someone who knows might be able to update this wiki page: >> > >> > >> http://wicketstuff.org/confluence/display/STUFFWEB/Home#Home-WheredoIdownloadstablereleases%3F >> > >> > Thanks, >> > -- Jim. >> > >> > On Tue, Jan 18, 2011 at 3:16 AM, Martin Grigorov <[email protected] >> > >wrote: >> > >> > > >> > > >> > >> https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/jasperreports-parent >> > > >> > > >> > >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
