How to store file in System.FileDocument entity in java action then download same file?

0
i am genrating excle in javaaction . but i am not able to store  in System.FileDocument entity .can anyone please help with this
asked
1 answers
2

You could try something like the below:

public void writeData(FileDocument outputDocument, XSSFWorkbook wb) throws Exception
{
    try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        wb.write(out);
        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray())) {
            Core.storeFileDocumentContent(context, outputDocument.getMendixObject(), inputStream);
        }
    }
}

FYI; this has been done numerous times before, please check the Excel Exporter module code as well on how this is done.

answered