Wiki source code of Project WONDER-Frameworks-ExcelGeneration
Last modified by David Holt on 2009/06/09 18:43
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
3.1 | 1 | == ExcelGeneration == |
![]() |
1.1 | 2 | |
![]() |
3.1 | 3 | === Anjo Krank === |
![]() |
1.1 | 4 | |
5 | You need to override appendToResponse on your page and make it look similar to: | ||
6 | |||
![]() |
3.1 | 7 | {{code}} |
![]() |
1.1 | 8 | |
![]() |
3.1 | 9 | public void appendToResponse(WOResponse response, WOContext context) { |
10 | super.appendToResponse(response, context); | ||
11 | if(reportData != null) { | ||
12 | response.setContent(reportData); | ||
13 | reportData = null; | ||
14 | String fileName = "results.xls"; | ||
15 | response.setHeader("inline; filename=\"" + fileName + "\"", "content-disposition"); | ||
16 | response.setHeader("application/vnd.ms-excel", "content-type"); | ||
17 | enableExcel = false; | ||
18 | } | ||
19 | } | ||
![]() |
1.1 | 20 | |
21 | |||
![]() |
3.1 | 22 | |
23 | {{/code}} | ||
![]() |
4.1 | 24 | |
![]() |
5.1 | 25 | Additionally from Anjo: |
![]() |
4.1 | 26 | |
27 | The idea behind ExcelGenerator ist that you can use - hopefully - the same HTML that you output anyway for your reporting tasks. In particular, you should be able to re-use DynaReporter HTML and you also need only a minimal amount of work to use D2W. | ||
28 | |||
29 | Sometimes, you might need to apply some xslt, but otherwise you don't need additional code and there is no "api" to learn. | ||
30 | |||
31 | It's just a wrapper to your tabular HTML and it kind of makes me wonder why there isn't already tool like it in the POI stuff. |