Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.1
    • Component/s: Export, HTML Generation
    • Labels:
      None
    • Testcase included:
      yes

      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:

         Export options: Excel | PDF | RTF | From: [1] To: [1] (default to this page)
         Export options: Excel | PDF | RTF | From: [1] To: [max] (default to all)

         Defaults to exporting what's on the page currently. Default would be
         configurable through property.

      6. Set the column width to the max column string value width.
      7. Exporters should support nested tables.
      8. Implement font styles in RTF export, e.g., bold face.
      9. Export in MS Word format using POI.

      Related Jira issues:
      <ol>
      <li>http://jira.codehaus.org/browse/DISPL-194
      <li>http://jira.codehaus.org/browse/DISPL-123
      </ol>

      Unit Tests:
      The main code change this patch supplies is a refactoring of the table-rendering
      code. As such, the relevant unit test are the existing tests,
      <a href="http://www.jamesgood.com:8080/displaytag-examples-1.1-SNAPSHOT/docs/multiproject/displaytag/junit-report.html">
      all of which succeeded.</a>

      -Jorge
      1. displaytagExamplePatch.txt
        35 kB
        Jorge L. Barroso
      2. displaytagExportPoiPatch.txt
        19 kB
        Jorge L. Barroso
      3. displaytagPatch.txt
        114 kB
        Jorge L. Barroso
      1. ico_file_rtf.png
        1.0 kB

        Activity

        Hide
        fabrizio giustina added a comment -
        great work!
        I ll review the patch to see if this can be included in 1.1... If this is not going to break other features I am all for commit it.
        Show
        fabrizio giustina added a comment - great work! I ll review the patch to see if this can be included in 1.1... If this is not going to break other features I am all for commit it.
        Hide
        Jorge L. Barroso added a comment -
        Thanks, Fabrizio.

        Let me know if I can be of further help getting this contribution included in 1.1.
        Show
        Jorge L. Barroso added a comment - Thanks, Fabrizio. Let me know if I can be of further help getting this contribution included in 1.1.
        Hide
        fabrizio giustina added a comment -
        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.
        Show
        fabrizio giustina added a comment - 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.
        Hide
        Jorge L. Barroso added a comment -
        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.
        Show
        Jorge L. Barroso added a comment - 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.
        Hide
        fabrizio giustina added a comment -
        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.
        Show
        fabrizio giustina added a comment - 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.
        Hide
        fabrizio giustina added a comment -
        already committed to cvs for 1.1, need a better documentation
        Show
        fabrizio giustina added a comment - already committed to cvs for 1.1, need a better documentation
        Hide
        Jeff Sheets added a comment -
        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
        Show
        Jeff Sheets added a comment - 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
        Hide
        Jorge L. Barroso added a comment -
        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?
        Show
        Jorge L. Barroso added a comment - 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?
        Hide
        Jeff Sheets added a comment -
        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)
                                                                                                                                
        Show
        Jeff Sheets added a comment - 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)                                                                                                                         
        Hide
        Jeff Sheets added a comment -
        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
        Show
        Jeff Sheets added a comment - 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
        Hide
        Jorge L. Barroso added a comment -
        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.

        Show
        Jorge L. Barroso added a comment - 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.
        Hide
        Jeff Sheets added a comment -
        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!
        Show
        Jeff Sheets added a comment - 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!
        Hide
        Jeff Sheets added a comment -
        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?
        Show
        Jeff Sheets added a comment - 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?
        Hide
        Jorge L. Barroso added a comment -
        > 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
        Show
        Jorge L. Barroso added a comment - > 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
        Hide
        Jeff Sheets added a comment -
        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?
        Show
        Jeff Sheets added a comment - 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?
        Hide
        Jorge L. Barroso added a comment -
        >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.
        Show
        Jorge L. Barroso added a comment - >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.
        Hide
        Jorge L. Barroso added a comment -
        >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.
        Show
        Jorge L. Barroso added a comment - >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.
        Hide
        Jeff Sheets added a comment -
        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...
        Show
        Jeff Sheets added a comment - 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...
        Hide
        Jeff Sheets added a comment -
        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...
        Show
        Jeff Sheets added a comment - 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...
        Hide
        Björn Wennerström added a comment -
        >Following are potential additional export enhacements I'm working on.
        >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.

        Any news on these features? They would be really nice
        Show
        Björn Wennerström added a comment - >Following are potential additional export enhacements I'm working on. >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. Any news on these features? They would be really nice
        Hide
        Jorge L. Barroso added a comment -
        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
        Show
        Jorge L. Barroso added a comment - 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
        Hide
        Jorge L. Barroso added a comment -
        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.
        Show
        Jorge L. Barroso added a comment - 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.
        Hide
        Björn Wennerström added a comment -
        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
        Show
        Björn Wennerström added a comment - 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
        Hide
        Dean Pullen added a comment -
        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.
        Show
        Dean Pullen added a comment - 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.
        Hide
        Jorge L. Barroso added a comment -
        Dean,

        A patch fixing the export.amount bug is available at http://jira.codehaus.org/browse/DISPL-292.

        -Jorge
        Show
        Jorge L. Barroso added a comment - Dean, A patch fixing the export.amount bug is available at http://jira.codehaus.org/browse/DISPL-292 . -Jorge
        Hide
        A K Alex added a comment -
        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?
        Show
        A K Alex added a comment - 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?

          People

          • Reporter:
            Anonymous
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: