You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Tim Colson <ti...@me.com> on 2013/08/23 13:31:15 UTC

Advice on using/extending ExcelExporter

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?

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.

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?

-Tim



 

Re: Advice on using/extending ExcelExporter

Posted by Ernesto Celis <ce...@yahoo.es>.

De: Tim Colson <ti...@me.com>

Para: user@click.apache.org 
>Enviado: Viernes, 23 de agosto, 2013 6:31:15
>Asunto: Advice on using/extending ExcelExporter
> 
>
>
>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. 
>
>
>
>Have you looked at the source code for the examples? It is 
available when you get click from svn, I see many properties files 
included along with supporting classes needed for the examples to work.
>
>I'm sorry but currently I'm too busy to look closely myself, maybe later since this could be useful to me sometime.
>
>
>
>
>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?
>
>
>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.
>
>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?
>
>
>-Tim
>
>
>
>
>
>
> 
>
>

Re: Advice on using/extending ExcelExporter

Posted by Tim Colson <ti...@me.com>.
Thanks, Bob for the help. 
I created a click-control.properties file and it works as a quick workaround for the banner mesg, and setting a param on the exportLink fixed problem #2. 
 
 AbstractLink exportLink = exporter.getExportLink();
        exportLink.setParameter("server", server);

You were correct that the ExcelExporter example does need some tweaks, for things like Date formatting, but it mostly just works, which is a great feature. 
If we continue to enhance it, perhaps we can find time to contribute an "extras" packaged version, if that would be seen as useful?

FYI - when I searched for "click extra" - the top hit goes to sourceforge.net ( http://click.sourceforge.net/docs/extras-api/) , from there, I tried drilling into "Deploying Custom Resources" which errors out. Going up to "http://click.sourceforge.net", I just barely noticed the "Important notice" banner mentioning the new home. I think clearing out the entire sourceforge site, except for a home page with a redirect banner, would make it easier for Google and people to find the latest info.

-Tim

Re: Advice on using/extending ExcelExporter

Posted by Bob Schellink <sa...@gmail.com>.
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