Jump to content

Images in Excel (xls) files


Recommended Posts

Hi,

I have a simple Excel file with just one sheet and one image in .xls and in .xlsx (attached in the zip file).

When reading the files using the XlsFormatProvider or XlsxFormatProvider, I get a workbook. When iterating the shapes on every sheet, I have a different result. I can retrieve the image using the XlsxFormatProvider in the xlsx file, but I'm not getting any shapes in the .xls file using the XlsFormatProvider.

Some code below:

var provider = new XlsxFormatProvider();
using (var fs = File.OpenRead("image.xlsx"))
{
    var workbook = provider.Import(fs);
    Assert.AreEqual(workbook.ActiveWorksheet.Shapes.Images.Count(), 1);
}

Should I be doing this differently? Or is this a known limitation?

I'm using version 2021.3.909.40.

Link to comment
Share on other sites

Just now, gugtenterf said:

Hi,

I have a simple Excel file with just one sheet and one image in .xls and in .xlsx (attached in the zip file).

When reading the files using the XlsFormatProvider or XlsxFormatProvider, I get a workbook. When iterating the shapes on every sheet, I have a different result. I can retrieve the image using the XlsxFormatProvider in the xlsx file, but I'm not getting any shapes in the .xls file using the XlsFormatProvider.

Some code below:

var provider = new XlsxFormatProvider();
using (var fs = File.OpenRead("image.xlsx"))
{
    var workbook = provider.Import(fs);
    Assert.AreEqual(workbook.ActiveWorksheet.Shapes.Images.Count(), 1);
}

Should I be doing this differently? Or is this a known limitation?

I'm using version 2021.3.909.40.

https://file-types.com/docs/xls

thanks in advance for any help

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...