I am writing an application that generates excel worksheets that might contain images in the first column. (Stackoverflow question trying to solve the same issue from that side is here)

Say I have a worksheet that looks like this (with filtering enabled):

enter image description here

Where column A includes crudely drawn images of the numerals "1" and "3".

You can also download example worksheets here: https://github.com/dan-kirberger/poi-excel-image-issue/tree/master/examples if you're up for trusting a stranger's files!

When editing the picture properties, you can choose from the following options: enter image description here

If I choose "Move and size with cells" then try to sort the sheet, the images don't get sorted (though the rest of the data does):

enter image description here

Notice the "1" in the image column no longer matches the "Text" column.

If I choose "Move but don't size with cells" then use the filter option, say on column C: enter image description here

Then the images stick around after the rest of their row's data is hidden.

How would I set up these pictures so both filtering AND sorting get applied to the image column?


The method you described in the question seems to be working. Be sure to resize the cells based on the size of the image and then choose the option "Move and size with cells".

Also I would recommend converting the data into a Table as you can visually see the filter range.

Find an example file in the below link:
Filter and Sort Images in Excel

UnFiltered Data Image
Un-Filtered Data - Image

Filtered Data - Image
Filtered Data - Image

| improve this answer | |
  • Thanks! Part of my issue was my real worksheet had different sized rows so sorting would break because the data's new row would not be tall enough. – Dan Jul 9 '19 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.