Wiki source code of Programming__WebObjects-Project WONDER-Frameworks-ExcelGeneration
Version 2.1 by smmccraw on 2007/07/08 09:45
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | == ExcelGeneration == | ||
| 2 | |||
| 3 | === Anjo Krank === | ||
| 4 | |||
| 5 | You need to override appendToResponse on your page and make it look similar to: | ||
| 6 | |||
| 7 | {{panel}} | ||
| 8 | |||
| 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 | } | ||
| 20 | |||
| 21 | {{/panel}} | ||
| 22 | |||
| 23 | Category:WebObjects |