可以尝试写成内存流用ByteArrayOutputStream,然后写到response里面
https://demo.grapecity.com.cn/documents-api-excel-java/docs/ImportAndExportJsonStream.html?highlight=bytearrayoutputstream%2C
- OutputStream outputStream = new ByteArrayOutputStream();
- workbook.toJson(outputStream);
- ByteArrayOutputStream buffer = (ByteArrayOutputStream) outputStream;
- byte[] bytes = buffer.toByteArray();
- InputStream inputStream = new ByteArrayInputStream(bytes);
- workbook1.fromJson(inputStream);
复制代码
|