you have the webresponse, can you not simply write into it?

-igor

On Thu, Jun 4, 2009 at 9:49 AM, Frank Silbermann
<[email protected]> wrote:
>
> I, too, am trying to have my application download MS Excel files.  Until now,
> mine have contained the content of a DataTable, using the code I received
> from the mailing list three years ago:
>
> Button button = new Button("excelExport") {
>    public void onSubmit() {
>        getRequestCycle().setRequestTarget(
>                        new ComponentRequestTarget(dataTable)
>        );
>        WebResponse wr = (WebResponse)getResponse();
>        wr.setContentType( "excel/ms-excel; name="+getMSExcelFilename() );
>        wr.setHeader( "content-disposition",
> "attachment;filename="+getMSExcelFilename() );
>    }
> };
>
> The file downloaded contains an HTML fragment that both MS Excel and MS Word
> can interpret, if one opens the resulting file in those applications.
>
> Now my users told me they would like the download to contain not just the
> data, but the date of its creation.  Is there an easy way to pre-pend an
> arbitrary string to that HTML fragment?  I don't really understand the
> details of Wicket's page rendering process, and looking at the classes I've
> been using there don't seem to be any obvious hooks.
>
>
>
>
>    stream = class AbstractResourceStreamWriter()
>                    {
>                          public void write(OutputStream output)
>                         {
>                               // do your writing
>                         }
>                    }
>
>     getRequestCycle().setRequestTarget(
>                     new ResourceStreamRequestTarget( stream ).setFileName(
> "file.xls" )
>    );
>
> johan
>
>
> On Tue, Apr 1, 2008 at 9:31 AM, <[email protected]> wrote:
>
>> Hello:
>> I am trying to export dynamically generated excel file.
>> The generator would send the file.xls to an OutputStream.
> ...
>
> --
> View this message in context: 
> http://www.nabble.com/export-excel-file-via-an-OutputStream-tp16416239p23873774.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to