I am using ByteArrayResource and it works great (Wicket 1.5.6). It is not link.onClick, but may be will do?
Code:
ByteArrayResource surveyExportXlsx = new ByteArrayResource("application/vnd.ms-excel") {
      private static final long serialVersionUID = 1L;
      @Override
      protected byte[] getData(Attributes attributes) {
        Workbook wb = .... generate your Workbook ...
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        try {
          wb.write(os);
          return os.toByteArray();
        } catch (IOException ex) {
          .......
        }
      }
      @Override
protected void setResponseHeaders(ResourceResponse data, Attributes attributes) {
        SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd_HHmm");
data.setFileName("SurveyExport_" + df.format(new Date()) + ".xlsx");
        data.disableCaching();
        super.setResponseHeaders(data, attributes);
      }
    };
    add(new ResourceLink("downloadAsXlsx", surveyExportXlsx));



On 2012-05-11 10:46, khanshan wrote:
Ok, I want to ask lastly,

I dynamically generated a workbook HSSFWorkbook,
and I want client to download that file inside of onclick method of a link.
(BytearrayResource doesnt work, it makes problem, please another soulution)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/TableComponentAsXlsHandler-Problem-tp4616754p4625745.html
Sent from the Users forum mailing list archive at Nabble.com.

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


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

Reply via email to