How can i export a Spreadsheet to Excel ?
Thanks
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
Thanks Sebastien.
I’am trying to download it, how can i do this?
Problem solved.
File file = spreadsheet.write(“Lista”);
FileResource res = new FileResource(file);
Page.getCurrent().open(res, null, false);
Thanks.
@Sebastien Libert
Thanks for the great info.