Excel tab design and get an workbook in byte[]

I am generating converting a report from BO server in xls format. basically I am creating a base workbook and for each page of the report, i am creating a temporary workbook and adding it as a sheet in the orginal work book. ( if there is a better way to do this, please advice).


I need to get the byte[] of workbook. Please help me

Workbook workbook = new Workbook();
for(int i = 0; i <documentInstance.getReports().getCount(); i++){
xlsReportTab = documentInstance.getReports().getItem(i);
binaryView = (BinaryView)xlsReportTab.getView(OutputFormatType.XLS);
Workbook workbookTab = new Workbook();
workbookTab.getWorksheets().addSheet(0, xlsReportTab.getName());
// workbookTab.loadData(binaryView.getContentType());
workbook.getWorksheets().addSheet(i, xlsReportTab.getName());


Thanks for your inquiry. I will move your request to the Aspose.Cells forum and my colleagues will answer you shortly.

Best regards,


To get byte[] of Workbook, I think you can just save it to a ByteArrayOutputStream and then get byte[] from it.

Code sample:

ByteArrayOutputStream baos = new ByteArrayOutputStream(1024000);
byte[] arr = baos.toByteArray();

Please download the latest Aspose.Cells for Java v2.5.3.4.