|
Thanks, Fabrizio.
Let me know if I can be of further help getting this contribution included in 1.1. 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.
I'll post more documentation and tests soon.
Jorge L. Barroso made changes - 20/Oct/05 09:46 AM
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.
already committed to cvs for 1.1, need a better documentation
fabrizio giustina made changes - 29/Dec/05 11:14 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? 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) Also, this may be unrelated, but I have opened up
http://jira.codehaus.org/browse/DISPL-295 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. Jorge, thanks for all of your great help! 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. 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? >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. 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?
Thanks again... >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 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 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. 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,
A patch fixing the export.amount bug is available at http://jira.codehaus.org/browse/DISPL-292. -Jorge |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.