Hi Tim,

On 2013/08/23 13:31, Tim Colson wrote:
Hi everyone --

We've built a Click app for Confluence wiki management, and we want to give users an Excel export of a data table filled with metadata for wiki pages in for a specific Confluence space key. I googled and was happily surprised to find the Excel Export example for Apache Click. Woot!
(http://click.avoka.com/click-examples/general/excel-table-export.htm)

Looked easy enough, but the developer realized TableExporter was part of the examples package, and needs additional supporting classes and properties files, so he tried copying into our project, but ran into problems.

1) TableExportContainer.renderExportBanner()
-- Provides the link to the report, but is failing to load the properties file, is there some configuration that might need to be done?

Not really. Just copy the entire folder into your project, including the property files. If you rename the class you should also rename the property file.
Here is how Click resolves properties:

http://click.apache.org/docs/user-guide/html/ch03s04.html#message-resolution


2) Link with arguments
As a hack around #1, I replaced the banner code with a hard-coded MessageFormat.format("<span class=\"{0}\">Export options: [{1}]</span>", args); -- The link does not include the original URL parameter for SPACKEY which is needed to load the pages for a particular space from the DB. -- Looks like we need to try exportTable.setExportLink( ) to embed the params in the URL? Setup an ActionLink? PageLink? Need to create a new method to get the data? Confused here.

    Not sure really. setExportLink sounds like it could work.

3) Best way to Leverage the ExcelExporter classes
The classes are doing a lot of heavy lifting with POI, but copying them seems like a bad idea long term. Suggestions?

I would just copy them into the project and adjust them to your needs. The example tries to show how to integrate with POI, but probably won't cover all scenarios that you would need especially when converting Java into Excel types. This method might need tweaking:

ExcelTableExporter#setCellValue(Object o, HSSFCell cell);

Kind regards

Bob

Reply via email to