Adding GIF throws error

Hello,

adding a picture with GIF file throws an error "Unsupported format". However, in the documentation to AddPicture GIF is listed.

snippet:

Could you please give me some advice.

Thomas

Hi,

Which version of Aspose.Cells for Java you are using? I tried the latest version/fix (attached) and it works fine. Following is my test java code and attached is the output file containing the gif image.

Sample code:

Workbook workbook = new Workbook();
Worksheets ws = workbook.getWorksheets();
Worksheet sheet1 = ws.getSheet(0);
Picture pic = sheet1.getShapes().addPicture(1,1,"f:\\test\\chart.gif");
workbook.save("e:\\files\\gifpictest.xls");

Please try the attached version and let us know about it.

Thank you.

Hi,

Thank you for your quick response. I have installed your newer version 2.1.0.5. Then I have tried your code snippet with some of my gifs. And I always get the same error "Unsupported image format".

Perhaps you can try it with one of my gifs (attached).

Thanks.

Thomas

Hi Thomas,

Well, i tried using your attached gif file, the image inserted into the sheet fine. I used the following code and attached is my generated excel file containing the gif image you posted.

Workbook workbook = new Workbook();
Worksheets ws = workbook.getWorksheets();
Worksheet sheet1 = ws.getSheet(0);
Picture pic = sheet1.getShapes().addPicture(1,1,"e:\\files\\draft.gif");
workbook.save("e:\\files\\gif_pictest.xls");

Please make sure that you are using the version that I attached in my previous post.

Thank you.

Hi Amjad,

Sorry, but no chance with gifs. By the way, I have similar problems with WMF files. The error here is "Could not get image reader".

Picture formats like jpg and bmp are inserted perfectly.

Do you have any further idea, what's going wrong here.

In order to substitute this GIF, I would really create it in new matter and save it as JPEG. But the problem is, that our customer has given us nearly 400 GIFS. And this job is too hard for me ;-)

Thomas

Hi Thomas,

Thanks for providing us further details.

We will look into your issue and get back to you soon.

By the way, could you give us complete detail about your environment including OS etc.

Thank you.

Hi Thomas,

Could you create a standalone Java program (similar to my code in my previous post) to test the gif image if it can be inserted fine (without producing the error) into the spreadsheet on your environment. I think, at least, it can confirm whether the issue is related to cold fusion or something else.

Thanks for your workaround.

Hi Amjad,

My OS is Windows XP SP3, PE is Coldfusion 8. My complete CF source code for the inserting picture looks like:






As I said in the last post, the above code works with JPEG and BMP files. The error comes with GIF file format.

Nice day.

Thomas

Hi Thomas,

Thanks for providing us further details.

Could you use pure Java language (not coldfusion) to create a Java program (similar to my code in my previous post) to test the gif image issue in its jre in your environment.

Thanks for your work.

Hi Thomas,

Would you please tell us the version information of your JDK/JRE? We have tested several JDK/JREs from 1.4.1_01 and the code for creating Picture from your gif file can run successfully. If needed, We will provide you some test programs according to your JDK/JRE to trace the issue.

Thank you.

Hello,

Our JRE version is 1.6.0_15. This version is embedded in Coldfusion-Adminstrator. CF is our main development platform. Ok, perhaps your right and coldfusion creates its own overlapping errors. But I am amazed, that the same CF code works correctly with jpg and bmp. Unfortunately I can't give you test results with pure java. I'm little bit puzzled what we can else. My way out of the "gif problem" is a workaround. I preloaded the gifs in Excel template and can dynamically remove from source.

Greets

Thomas