For a POI workbook I created in cuba, i want to download it using ExportDisplay. But I don’t see FileOutputStream in Cuba. How would I do this?
SomeServicemethod(String somefileName) {
. . .
try (FileOutputStream outputStream = new FileOutputStream(new File(somefileName))) {
workbook.write(outputStream);
outputStream.flush();
}
SomeScreen
@Inject
private ExportDisplay exportDisplay;
OnSomeEvent(){
SomeServicemethod("somefileName.xlsx");
byte[] bytes;
try {
bytes = html.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
exportDisplay.show(new ByteArrayDataProvider(bytes), "somefileName.xlsx", ExportFormat.XLSX);
}