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

Free Support Forum - aspose.com

XLS files failed to load image in lastest version 18.12 but work on version 18.4

Hi,

I’m updating Aspose Cells from version 18.4 to version 18.12, but I have met an issue with some specific XLS that I need your help.

With version 18.4, I can load the files and image correctly without exception, but in new version 18.12, when I load a image inside the file, exception “Unexpected image type” will be thrown.

Sample code:
string inputFile = @“sample.xls”;
Aspose.Cells.LoadOptions option = new Aspose.Cells.LoadOptions();
option.MemorySetting = MemorySetting.MemoryPreference;
FileStream inStream = new FileStream(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Workbook workbook = new Workbook(inStream, opt);
foreach(Worksheet worksheet in workbook.Worksheets)
{
Aspose.Cells.Drawing.PictureCollection pc = worksheet.Pictures;
foreach(Picture pic in pc)
{
String fileExtension = pic.ImageFormat.ToString();
}
}
Here is my sample file:
sample.zip (3.0 MB)

If you want to know another information, please reply here.

Thanks you,

Dung. H Nguyen

@dunghnguyen,

The property ImageFormat is obsolete now so please use pic.ImageType property which does not reproduce any exception.

Let us know your feedback.

Hi @ahsaniqbalsidiqui,

Your solution worked in my sample. Thanks you for your reply.

Happy new year.

Dung. H Nguyen

@dunghnguyen,

Good to know that your issue is sorted out by the suggested code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.