Details

Description

Request for enhancements of the export facility

1. The default exporters should render the table as close as possible
to the rendered HTML. When typical business users are presented with the
displaytag export facility, they usually expect the exported Excel or PDF to
look just like the HTML in their browser; they expect a WYSIWYG rendering.
2. The export API should encourage reuse of the table-rendering logic
employed to render the table in a JSP. For instance, to render the grouping
in my PDF export just as it appears in the HTML, I would have had to
re-implement TableTag.groupColumns(). Also, any future changes to the
table rendering would not be included in my PDF export. So, this looked
like a job for the Template Method pattern, which also applies nicely to the
decorators, to ensure that the HTML and default export
renderings will be in synch.
3. Include caption in export.
4. Include footer in export.
5. Export in RTF format.
The attached patch implements the above enhancements.
<a href="http://www.jamesgood.com:8080/displaytag-examples-1.1-SNAPSHOT/example-new-export.jsp">
Here's a live example and a more detailed explanation.</a>

Following are potential additional export enhacements I'm working on.
1. Use css table styles as style configuration for Excel, PDF, and RTF exports.
If not practical, provide export style config properties.
2. Specify Excel formats for columns, e.g., ##.##.
3. Include smart linking in Excel, PDF, and RTF exports.
4. Export just the current page, a page range, or all data, especially if
paging is used.
The ui may look like this:

Finally committed to svn.
Jorge, it would be great if you can also provide some documentation and tests for the new features... also your sample page for the web application looks nice, can you post it as a patch?

I'll leave the issue open in Jira to track the documentation/tests lack.

fabrizio giustina
added a comment - 16/Oct/05 3:36 PM Finally committed to svn.
Jorge, it would be great if you can also provide some documentation and tests for the new features... also your sample page for the web application looks nice, can you post it as a patch?
I'll leave the issue open in Jira to track the documentation/tests lack.

Here's the patch for the example page. I pointed the source code links to the 1.1 site. However, the links to the Excel source files and decorators won't work until the xref files are generated for the displaytag-export-poi and displaytag-examples projects. This patch also includes a fix to export-example.jsp, as the jspx was broken, and a fix to the export div css class, whose negative margin was causng the export section to hide the footer. Finally, I'm including the rtf icon I used in the example, but it should be made green to be consistent with the rest of the export icons.

Jorge L. Barroso
added a comment - 20/Oct/05 9:46 AM Here's the patch for the example page. I pointed the source code links to the 1.1 site. However, the links to the Excel source files and decorators won't work until the xref files are generated for the displaytag-export-poi and displaytag-examples projects. This patch also includes a fix to export-example.jsp, as the jspx was broken, and a fix to the export div css class, whose negative margin was causng the export section to hide the footer. Finally, I'm including the rtf icon I used in the example, but it should be made green to be consistent with the rest of the export icons.
I'll post more documentation and tests soon.

fabrizio giustina
added a comment - 27/Oct/05 4:15 PM examples committed to cvs. Note: i would like to remove all the external links to java sources, the example webapp should be indipendent from the displaytag website.

Is there a property that I need to set before the caption and footer are exported in pdf/excel/etc...? I've upgraded to 1.1, but my captions are still not being put in the exported file.

Also I can't seem to get the rtf export to work. I tried setting up these properties, but I'm getting an exception at export time still:
export.types=csv excel xml pdf rtf
export.rtf.class=org.displaytag.export.DefaultRtfExportView
export.rtf=true

Jeff Sheets
added a comment - 01/Mar/06 9:23 AM Is there a property that I need to set before the caption and footer are exported in pdf/excel/etc...? I've upgraded to 1.1, but my captions are still not being put in the exported file.
Also I can't seem to get the rtf export to work. I tried setting up these properties, but I'm getting an exception at export time still:
export.types=csv excel xml pdf rtf
export.rtf.class=org.displaytag.export.DefaultRtfExportView
export.rtf=true

Re, "Is there a property that I need to set before the caption and footer are exported in pdf/excel/etc...? I've upgraded to 1.1, but my captions are still not being put in the exported file. " Yes, you need to set the media type in the caption and footer tags, as in <display:caption media="excel pdf rtf">. Usually, you'd set up one caption/footer tag for html and another for the rest, to avoid html markup ending up in your other media files.

Your rtf config looks correct. If PDF exports are working for you with DefaultPdfExportView, so should RTF with DefaultRtfExportView, as these views are thin facades that delegate to the iText writers to do the heavy table rendering work. In other words, PDF and RTF are generated by the same code. Could you email the list the exception you're getting?

Jorge L. Barroso
added a comment - 01/Mar/06 10:43 AM Re, "Is there a property that I need to set before the caption and footer are exported in pdf/excel/etc...? I've upgraded to 1.1, but my captions are still not being put in the exported file. " Yes, you need to set the media type in the caption and footer tags, as in <display:caption media="excel pdf rtf">. Usually, you'd set up one caption/footer tag for html and another for the rest, to avoid html markup ending up in your other media files.
Your rtf config looks correct. If PDF exports are working for you with DefaultPdfExportView, so should RTF with DefaultRtfExportView, as these views are thin facades that delegate to the iText writers to do the heavy table rendering work. In other words, PDF and RTF are generated by the same code. Could you email the list the exception you're getting?

I want to use the same caption for all types. But I did try your test by using:
<display:caption media="html pdf rtf">
But I still do not see the caption on my pdf. It is showing fine on the html page.

PDF exporting is working fine (well, except for the missing caption), but I get this exception when trying to RTF export:

2006-03-01 11:42:26,024 [WEST.jasheets.GFbWfXNShJ] ERROR DefaultItextExportView Exception: [.DefaultItextExportView] !DefaultItextExportView.errorexporting! Cause: null
javax.servlet.jsp.JspException
at org.displaytag.render.TableWriterTemplate.writeTable(TableWriterTemplate.java:161)
at org.displaytag.export.DefaultItextExportView.doExport(DefaultItextExportView.java:73)
at org.displaytag.tags.TableTag.writeExport(TableTag.java:1410)
at org.displaytag.tags.TableTag.doExport(TableTag.java:1356)
at org.displaytag.tags.TableTag.doEndTag(TableTag.java:1227)
at jsp_servlet._reports.__callvolumestatsdetail._jspService(__callvolumestatsdetail.java:2360)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:642)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:423)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:154)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at jsp_servlet._include._staff.__notab._jspService(__notab.java:142)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:642)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:423)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:154)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at jsp_servlet._include._staff.__querydetail._jspService(__querydetail.java:181)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:642)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:423)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:154)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at jsp_servlet._include._staff.__layout._jspService(__layout.java:261)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:328)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:140)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.west.spectrum.ui.LoggingFilter.doFilter(LoggingFilter.java:69)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.west.spectrum.ui.SecurityFilter.doFilter(SecurityFilter.java:167)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

Jeff Sheets
added a comment - 01/Mar/06 11:46 AM I want to use the same caption for all types. But I did try your test by using:
<display:caption media="html pdf rtf">
But I still do not see the caption on my pdf. It is showing fine on the html page.
PDF exporting is working fine (well, except for the missing caption), but I get this exception when trying to RTF export:
2006-03-01 11:42:26,024 [WEST.jasheets.GFbWfXNShJ] ERROR DefaultItextExportView Exception: [.DefaultItextExportView] !DefaultItextExportView.errorexporting! Cause: null
javax.servlet.jsp.JspException
at org.displaytag.render.TableWriterTemplate.writeTable(TableWriterTemplate.java:161)
at org.displaytag.export.DefaultItextExportView.doExport(DefaultItextExportView.java:73)
at org.displaytag.tags.TableTag.writeExport(TableTag.java:1410)
at org.displaytag.tags.TableTag.doExport(TableTag.java:1356)
at org.displaytag.tags.TableTag.doEndTag(TableTag.java:1227)
at jsp_servlet._reports.__callvolumestatsdetail._jspService(__callvolumestatsdetail.java:2360)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:642)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:423)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:154)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at jsp_servlet._include._staff.__notab._jspService(__notab.java:142)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:642)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:423)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:154)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at jsp_servlet._include._staff.__querydetail._jspService(__querydetail.java:181)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:642)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:423)
at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:154)
at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at jsp_servlet._include._staff.__layout._jspService(__layout.java:261)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:328)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:140)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.west.spectrum.ui.LoggingFilter.doFilter(LoggingFilter.java:69)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.west.spectrum.ui.SecurityFilter.doFilter(SecurityFilter.java:167)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

Jeff Sheets
added a comment - 01/Mar/06 11:47 AM Also, this may be unrelated, but I have opened up DISPL-295 to deal with the "Export Decorator no longer defaults to table decorator":
http://jira.codehaus.org/browse/DISPL-295

If you want the same caption to be used in all media, html and exported, either include all media values or just exclude the media attribute.
<display:caption > or <display:caption media="html excel pdf rtf"> for instance.

Jorge L. Barroso
added a comment - 01/Mar/06 12:18 PM Could you double-check that your deploying itext 1.3? You may also want to double-check your code against this example, which shows exporting captions/footers to pdf and rtf.
http://displaytag.homeip.net/displaytag-examples-1.1/example-new-export.jsp
If you want the same caption to be used in all media, html and exported, either include all media values or just exclude the media attribute.
<display:caption > or <display:caption media="html excel pdf rtf"> for instance.
I'll take a look at 295.

Thanks so much for your help so far, Jorge! Displaytag is great, and these new additions will be great too...

For the caption/footer issue:
I had to setup the new export classes for PDF/Excel in my displaytag.properties file like this:
export.pdf.class=org.displaytag.export.DefaultPdfExportView
export.excel.class=org.displaytag.export.excel.DefaultHssfExportView
Apparently only these new classes will display the caption/footer? I didn't realize this before...

Secondly, the new classes only work when I remove my Decorator. So I'm going to look into my decorator and see why it fails on the exporting. My decorator works fine for any of the old export classes, but not the new ones that were added for the caption/footer. It throws the previous stack trace with the new export classes for RTF, Excel, and PDF.

For the RTF issue:
My setup from before works for RTF when I don't use my Decorator. There must be something that has changed in the new export classes that is different from the old for Decorator's.

Jeff Sheets
added a comment - 01/Mar/06 3:31 PM Thanks so much for your help so far, Jorge! Displaytag is great, and these new additions will be great too...
For the caption/footer issue:
I had to setup the new export classes for PDF/Excel in my displaytag.properties file like this:
export.pdf.class=org.displaytag.export.DefaultPdfExportView
export.excel.class=org.displaytag.export.excel.DefaultHssfExportView
Apparently only these new classes will display the caption/footer? I didn't realize this before...
Secondly, the new classes only work when I remove my Decorator. So I'm going to look into my decorator and see why it fails on the exporting. My decorator works fine for any of the old export classes, but not the new ones that were added for the caption/footer. It throws the previous stack trace with the new export classes for RTF, Excel, and PDF.
For the RTF issue:
My setup from before works for RTF when I don't use my Decorator. There must be something that has changed in the new export classes that is different from the old for Decorator's.
Jorge, thanks for all of your great help!

Jeff Sheets
added a comment - 01/Mar/06 4:08 PM Do I need to implement org.displaytag.decorator.itext.DecoratesItext and import org.displaytag.decorator.hssf.DecoratesHssf in my Decorator class? I saw these in one of the code examples here:
http://www.jamesgood.com:8080/displaytag-examples-1.1-SNAPSHOT/docs/multiproject/displaytag-examples/xref/org/displaytag/sample/ItextTotalWrapper.html
I'll try implementing DecoratesHssf for the Excel (it's in the displaytag-poi jar file), but DecoratesItext is not in the displaytag.jar. Should DecoratesItext be in the displaytag.jar?

> Apparently only these new classes will display the caption/footer? I didn't realize this before...

Yes, I added caption and footer to TableModel so that they'd be available
for export, but only the new Excel, PDF, and RTF exporters take advantage of
it (items 3&4 above). The others should too, espcially XML. For CSV, it might be less meaningful
and probably more problematic than it's worth, like when importing into Excel.

As for the decorator, use this sample code as a guide to how to write
decorators that work with the new exporters. I'll be documenting them soon, but the example is pretty straight forward and covers all the new features.

Jorge L. Barroso
added a comment - 01/Mar/06 4:19 PM > Apparently only these new classes will display the caption/footer? I didn't realize this before...
Yes, I added caption and footer to TableModel so that they'd be available
for export, but only the new Excel, PDF, and RTF exporters take advantage of
it (items 3&4 above). The others should too, espcially XML. For CSV, it might be less meaningful
and probably more problematic than it's worth, like when importing into Excel.
As for the decorator, use this sample code as a guide to how to write
decorators that work with the new exporters. I'll be documenting them soon, but the example is pretty straight forward and covers all the new features.
Look at this class and its media-specific children.
http://cvs.sourceforge.net/viewcvs.py/displaytag/displaytag-examples/src/main/java/org/displaytag/sample/decorators/TotalWrapperTemplate.java?rev=1.1&view=auto

Ok, I got the Decorator to work for Excel by implementing
org.displaytag.decorator.hssf.DecoratesHssf

I'd like to do the same, but
org.displaytag.decorator.itext.DecoratesItext
is not in the displaytag.jar. Can a new jar be created with this file in it, and can I grab this file from somewhere else in the meantime?

Jeff Sheets
added a comment - 01/Mar/06 4:28 PM Ok, I got the Decorator to work for Excel by implementing
org.displaytag.decorator.hssf.DecoratesHssf
I'd like to do the same, but
org.displaytag.decorator.itext.DecoratesItext
is not in the displaytag.jar. Can a new jar be created with this file in it, and can I grab this file from somewhere else in the meantime?

That's my original, pre-1.1 example. Use the browse-source link above to follow the final 1.1 example.
Your iText (PDF/RTF) decorators need to implement
org.displaytag.render.ItextTableWriter.ItextDecorator so that they can write to the iText table being rendered.
Your Hssf (Excel) decorator needs to implement org.displaytag.decorator.hssf.DecoratesHssf so that it can write to the HssfSheet being rendered.

Jorge L. Barroso
added a comment - 01/Mar/06 4:32 PM >Do I need to implement org.displaytag.decorator.itext.DecoratesItext and import org.displaytag.decorator.hssf.DecoratesHssf in my Decorator class? I saw these in one of the code examples here:
> http://www.jamesgood.com:8080/displaytag-examples-1.1-SNAPSHOT/docs/multiproject/displaytag-examples/xref/org/displaytag/sample/ItextTotalWrapper.html
>I'll try implementing DecoratesHssf for the Excel (it's in the displaytag-poi jar file), but DecoratesItext is not in the displaytag.jar. Should DecoratesItext be in the displaytag.jar?
That's my original, pre-1.1 example. Use the browse-source link above to follow the final 1.1 example.
Your iText (PDF/RTF) decorators need to implement
org.displaytag.render.ItextTableWriter.ItextDecorator so that they can write to the iText table being rendered.
Your Hssf (Excel) decorator needs to implement org.displaytag.decorator.hssf.DecoratesHssf so that it can write to the HssfSheet being rendered.

>I'd like to do the same, but
>org.displaytag.decorator.itext.DecoratesItext
>is not in the displaytag.jar. Can a new jar be created with this file in it, and can I grab this file from somewhere else in the meantime?

You were looking at the pre-release example.
org.displaytag.render.ItextTableWriter.ItextDecorator is what you need.

Jorge L. Barroso
added a comment - 01/Mar/06 4:35 PM >I'd like to do the same, but
>org.displaytag.decorator.itext.DecoratesItext
>is not in the displaytag.jar. Can a new jar be created with this file in it, and can I grab this file from somewhere else in the meantime?
You were looking at the pre-release example.
org.displaytag.render.ItextTableWriter.ItextDecorator is what you need.

How hard would it be to change the export to export the footer as a bottom row in the table? This would seem like more correct behaviour than adding the footer to a single cell at the bottom of the table.

Jeff Sheets
added a comment - 15/Mar/06 2:38 PM I would like to export a footer of the form:
<display:footer>
<tr>
<td>Bottom of Col 1</td>
<td>Bottom of Col 2</td>
<td>Bottom of Col 3</td>
</tr>
</display:footer>
How hard would it be to change the export to export the footer as a bottom row in the table? This would seem like more correct behaviour than adding the footer to a single cell at the bottom of the table.
Thanks...

Another feature that would be great to see would be an easy way to change the size of the Caption Font. Currently this is hardcoded to 17 and I don't see an easy way to make it smaller without recompiling, but perhaps you know of a way?

Jeff Sheets
added a comment - 15/Mar/06 3:16 PM Another feature that would be great to see would be an easy way to change the size of the Caption Font. Currently this is hardcoded to 17 and I don't see an easy way to make it smaller without recompiling, but perhaps you know of a way?
Thanks again...

Unfortunately, I haven't had a chance to work on 2 or 7. But, it's good to know there's a demand for these features. I hope to have the contribution ready in time for the next feature release. As for #6, it's aleary implemented in 1.1, but for Excel, within poi's limitations. poi's hssf library doesn't support specifying an exact column width: it only accepts a suggested width. So, for Excel, specifying a maximum column width only improves the chances of the column being set to said width, but does not guarantee it.

Jorge L. Barroso
added a comment - 05/Jul/06 10:20 AM Hi, Björn.
Regarding,
>2. Specify Excel formats for columns, e.g., ##.##.
>6. Set the column width to the max column string value width.
>7. Exporters should support nested tables...
Unfortunately, I haven't had a chance to work on 2 or 7. But, it's good to know there's a demand for these features. I hope to have the contribution ready in time for the next feature release. As for #6, it's aleary implemented in 1.1, but for Excel, within poi's limitations. poi's hssf library doesn't support specifying an exact column width: it only accepts a suggested width. So, for Excel, specifying a maximum column width only improves the chances of the column being set to said width, but does not guarantee it.
-J

Regarding,
>6. Set the column width to the max column string value width.
Correction: The code for setting the max width did not make it into the 1.1 default excel exporter. I got it confused with my local copy, which has it. It should be added to the next release, but the poi limitations I mentioned still hold.

Jorge L. Barroso
added a comment - 06/Jul/06 10:26 AM Hi, Björn.
Regarding,
>6. Set the column width to the max column string value width.
Correction: The code for setting the max width did not make it into the 1.1 default excel exporter. I got it confused with my local copy, which has it. It should be added to the next release, but the poi limitations I mentioned still hold.

We're really interested in nested tables because it's the only way we can see for doing an Excel export with two sheets that get their data from different tables. Or is there another way? I'll be offline for a few weeks now, but in August I'll have to find a solution to this somehow

Björn Wennerström
added a comment - 07/Jul/06 3:28 PM Thanks for the update!
We're really interested in nested tables because it's the only way we can see for doing an Excel export with two sheets that get their data from different tables. Or is there another way? I'll be offline for a few weeks now, but in August I'll have to find a solution to this somehow

These new 'default' classes (e.g. DefaultPdfExportView ) do not export the full list of table data when paging is on, and thus must disregard the export.amount=list param in display.properties.
How can I get both the footer and the full table list of data exported? All though this is meant to be WYSIWYG, I think that param should still be examined.

Dean Pullen
added a comment - 05/Sep/06 11:12 AM These new 'default' classes (e.g. DefaultPdfExportView ) do not export the full list of table data when paging is on, and thus must disregard the export.amount=list param in display.properties.
How can I get both the footer and the full table list of data exported? All though this is meant to be WYSIWYG, I think that param should still be examined.

A K Alex
added a comment - 02/Jan/07 2:28 PM I would like to export a footer of the form:
<display:footer>
<tr>
<td>Total of Col 1</td>
<td>Total of Col 2</td>
<td>Total of Col 3</td>
</tr>
</display:footer>
Any solutions?