Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 2 weeks ago
Export Spreadsheet to Excel
Hi,
Never done myself but you probably can get some inspiration from JUnit test :
@Test
public void openAndSaveFile_emptyXLSXFile_openAndSaveWorks()
throws URISyntaxException, IOException {
URL testSheetResource = this.getClass().getClassLoader()
.getResource("test_sheets/empty.xlsx");
File testSheetFIle = new File(testSheetResource.toURI());
Spreadsheet sheet = new Spreadsheet(testSheetFIle);
File tempFile = File.createTempFile("resultEmptyFile", "xlsx");
FileOutputStream tempOutputStream = new FileOutputStream(tempFile);
sheet.write(tempOutputStream);
tempOutputStream.close();
tempFile.delete();
// no exceptions, everything ok
}
Regards
Sebastien
Last updated on
Thanks Sebastien.
I'am trying to download it, how can i do this?
Last updated on
Problem solved.
File file = spreadsheet.write("Lista");
FileResource res = new FileResource(file);
Page.getCurrent().open(res, null, false);
Thanks.
Last updated on
You cannot reply to this thread.