In my application, It is downloading an excel from FileOutputStream directly to the browser.
I have to use Aspose cells Workbook to read the file from FileOutputStream and do some operations on Workbook.
I am able to do the operations on Workbook if I take a File. But in my application, I am only getting FileOutputStream.
How to write the FileOutputStream to the aspose cells workbook.
As you know, java’s OutputStream is for writing data only. Only InputStream can provide the data of the template file to instantiate a Workbook. If you are using FileInputStream, you may use Workbook to instantiate the Workbook object and then do other operations you need.
ok, I got that part.
Is it possible to convert org.apache.poi.xssf.streaming.SXSSFWorkbook to com.aspose.cells.Workbook .
The excel which is getting written to the FileOutputStream is of SXSSFWorkbook . There are lot of logic and operations involved to create the workbook(SXSSFWorkbook ) , so I don’t want to mess with that.
I understand these those are totally different product but is there any option to get the Aspose cells Workbook from SXSSFWorkbook type.
We are afraid there is no such kind of apis to do the conversion between those two different java classes.
However, for you requirement we think the best way is that you can save the workbook model of SXSSFWorkbook to resultant spreadsheet file and then load the generated file as com.aspose.cells.Workbook.
And it is not necessary for you to save file to disk. Instead you may save it to memory, such as save to a ByteArrayOutputStream. Then you can build a ByteArrayInputStream from the array data of the ByteArrayOutputStream and instantiate com.aspose.cells.Workbook from the input stream.