sheet.Pictures Missing Parts are Set to the Pictures Placed on the Cells


If an image is set to be placed in the cell, sheet.Pictures cannot get it.


  • Aspose.Cells for .NET 24.6
  • Windows 11


void Test()
	var doc=new Aspose.Cells.Workbook(@"C:\Users\Administrator\Desktop\test\1.xlsx");
	doc.Worksheets[0].Pictures.Count.Dump();// output 3, expected 6.

Test File

For the pictures in A2:A4, they are set as “Place in Cell” which is different from pictures in range A5:A7. For “Place in Cell” pictures, they are attached with cell instead of the PictureCollection/ShapeCollection. To get such kind of pictures, please use Cell.EmbeddedImage.

Thanks for your help, but I don’t think it’s a good way to foreach all cells and get each of theirs picture via Cell.EmbeddedImage. Maybe you can optimize the api?

When using “Place in Cell” to insert an image, we cannot make any settings on the image, it is only an image data related to the Cell. The API design of “Place in Cell” is consistent with Excel.

By creating two sample files for comparison, you will find that only images inserted with “Place over Cells” will generate a drawing directory in the file, and various settings and information of the images will be saved in the file “drawing1.xml”. Please check the attachment. (129.4 KB)

Of course, we have taken note of your suggestion. We will further investigate the possibility of optimizing the api. If there are any updates, we will notify you promptly.

If the pictures are in Cell, they are scattered in the cell settings.
There is no simple solution.

For traversing such kind of pictures(Place in Cell), we will investigate whether we can provide one api to enumerate all such kind of cell for user’s convenience and better performance.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-56093

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

Please try Cells.GetCellsWithPlaceInCellPicture() with 24.7 to get all cells which are image placed in:

Workbook workbook = new Workbook(dir + "book1.xlsx");
Cells cells = workbook.Worksheets[0].Cells;
for(IEnumerator ie=  cells.GetCellsWithPlaceInCellPicture();ie.MoveNext();)
    Cell cell = (Cell)ie.Current;
    byte[] data = cell.EmbeddedImage;
    File.WriteAllBytes(dir + cell.Name + ".png", data);
workbook.Save(dir + "dest.xlsx");