We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create slides with embedded image fails

I am using ASPOSE.cell to create excel sheet base on a external web services request that response back with binary xlsx format. This works fine with the return object does not contain image. But if the XLSX binary stream returns with embedded image. I get the following exception at the bottom. The method that throw the exception is:

new Workbook (restGetWebServices(page number, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet").getContent());

Truncated chunk ( expected size: 8192; actual size: 7994)

Hi Jeremy,

Thanks for your posting and using Aspose.Cells.

Please see the following simple JSP program that creates a workbook and add some text in cell A1 of the first worksheet, then it sends the file to HttpServletResponse stream. The output file name that is sent is “Test.xlsx” , you can name it anything and it saves the workbook in XLSX format.

Please run it at your end and then modify your own code similar to it and check the results.

JSP


//Create a workbook

Workbook wb = new Workbook();


//Access the first worksheet

Worksheet ws = wb.getWorksheets().get(0);


//Add some text in cell A1

Cell cell = ws.getCells().get(“A1”);

cell.putValue(“Welcome to Aspose!”);


//Set the content type and add header

String contentType = “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”;

response.setContentType(contentType);

response.addHeader(“content-disposition”, “inline;filename=Test.xlsx”);


//Save the workbook in response stream

wb.save(response.getOutputStream(), SaveFormat.XLSX);

Hi mshakeel.faiz,



Thanks for the quick reply. My question is not how to import an excel sheet. I have already done this successfully. My problem were when I import an excel sheet which has charts\embedded jpegs, I am getting exception as below. My program works fine when spreadsheet was just table of data.

Truncated chunk ( expected size: 8192; actual size: 7994)



-jeremy

Hi Jeremy,

Thanks for your posting and using Aspose.Cells.

Please download and try the latest version: Aspose.Cells for Java (Latest Version) and see if it resolves your issue.

In case the issue still exists, then please provide us your source Excel file which is throwing exception and sample code replicating your issue. We will look into it and update you asap.

Yes, the issue of loading images and charts component has been resolved with 8.2.0.3.

Thanks!

Hi Jeremy,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest version. :slight_smile: Let us know if you encounter any other issue, we will be glad to look into it and help you further.