How to convert the files to zip using Aspose cells

I have a requirement where I have to create a zip from the Excel files.

Now I am doing by writing the documents to ZipOutputStream.

But I need to do some operations on those Excel(workbook) using aspose cells and write those files again to ZIP.

I have ByteArrayOutputStream and ZipOutputStream where the content is getting written.

I have to do some operations on each excel docs using aspose cells and then again write these document to zipoutputstream so that I can get all these docs in zipped manner.

Any suggestions will be of great help.

@rinkusm,

Aspose.Cells is an Excel spreadsheet management (create, manipulate, render, print MS Excel file formats and other formats) API, so your task is out of scope/context. May be you could use Aspose.ZIP API for your requirements.

@rinkusm,

What kind of excel files are you using for those operations? If they are files such as xlsx, xlsb, ods, …etc., those file formats are zip format already and you do not need to zip them again. However, if you do need write a workbook to your own ZipOutputStream, no matter they are zip format or not, it is still feasible. The code example:

Workbook wb = new Workbook(...);
//your operations on the workbook
...
//build your own zip stream
ZipOutputStream zos = new ZipOutputStream(...);
//put the entry for the generated excel file
zos.putNextEntry(new ZipEntry("res.xlsx"));
//save workbook to the zip stream
wb.save(zos, FileFormatType.XLSX);
zos.close();
...

Hope that helps a bit and if you have any other issue we will be glad to provide assistance.