Setting JPG in footer giving issues

Hi,

I have issues setting a jpg file in the footer using aspose cells JAVA. It works fine with a gif image. can you please let me know if there is some issue with my code? Please reply with any changes in JAVA.Thanks.

URL url = new URL(sLogo);

InputStream openStream = url.openStream();

int contentLength = openStream.available();

picData = new byte[contentLength];

openStream.read(picData);

worksheet.getPageSetup().setFooterPicture(2, picData);

Error:

com.aspose.cells.CellsException: Unknown image format:-1

at com.aspose.cells.aC.a(Unknown Source)

at com.aspose.cells.eM.a(Unknown Source)

at com.aspose.cells.eK.a(Unknown Source)

at com.aspose.cells.ShapeCollection.a(Unknown Source)

at com.aspose.cells.PageSetup.a(Unknown Source)

at com.aspose.cells.PageSetup.setFooterPicture(Unknown Source)

Hi,

Thanks for your posting and using Aspose.Cells for Java.

Your code looks ok to me. Please make sure the JPG file you are using is actually intact and not corrupt file and also it’s format is in jpg.

If the problem still occurs, then please provide me your complete sample runnable code to look into this issue.

Please download and use the latest version:
Aspose.Cells
for Java v7.1.1.3