You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Karen Schaper <ka...@gmail.com> on 2009/08/18 21:29:17 UTC

Export Data from a Table

Hi,

I am trying to export the contents of DefaultDataTable

to an excel spreadsheet.

I found this post...

http://www.nabble.com/export-excel-file-via-an-OutputStream-td16416239.html#a16416239

which had a snippet of code in which the user indicates no longer
outputs the data but a fragment of html.  There were responses but I'm
not following on how to get the data from the data table into the output
stream for an excel spreadsheet.

Here's the snippet of code that I was looking at.

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() ); 
    } 
};

Any help is greatly appreciated!

Thanks

Karen




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org