Downloading files

I need to make a excel exporter for a table. I use a button to “Export” and this button generate the xsl file in a directory.

The problem is how download the file :frowning:

Any suggestion??

-Felipe

Serve the file as a
FileResource
or, more conveniently, as a
StreamResource
. Then use a
Link
component to point to that resource,
as is done here
.

If you’re a Pro Account subscriber, see article
#230
.

Thanks for your response Marko bat the problem is that i need to genereta de file when the user press the button an then automaticaly download the file. I can not do it in two step. Ej.

  1. The user view the table
  2. The user press export button that generate the file
  3. The file is automaticaly downloaded

I can not use a Link because i dont have the file when the table is rendered.

Thanks

-Felipe

Then you should use a StreamResource to generate the file dynamically by the Vaadin application.