load cells with icons

I have an app that already uses FlexcelImport and Flexcelgrid and XLS template store.

My client has asked me to now produce a report that fills potentially hundreds of cells with an icon symbol rather than text label to indicate a condition.  typically the icon would be 16x16 pixels.

I have been trying to think of ways of doing this...

1. Copy and paste a png image to each of the cells? if ythe image is in the template XLS
2. Load an image stored on disk into each cell
2. Load a font such as font-awesome and use font symbols

Do you have a recommendation or other ideas how I should do it?

And if possible can you kindly show me some code on how I would do it?

Thank you very much for your assistance.


It depends on the symbol, but if you can get some font or unicode emoji for the icons, I would strongly prefer this to adding thousands of images. Thousands of images can be slow (especially if you are using XlsAdapter and not XlsxAdapter which is more optimized for thousands images), and those images are just difficult to manage since they don't belong into a cell like a emoji or some special font does. (they float over the cell). Also images in fonts support hinting, so they look better at smaller and big sizes and resolutions.

In decreasing order of preference, what I would do is:
1. The best solution if possible, is to use conditional format icons: http://www.tmssoftware.biz/flexcel/doc/net/tips/prefer-conditional-formats.html
But in this particular case it won't work, because TFlexCelGrid doesn't support them (TFlexCelPreviewer fully supports them but it is not a grid). It is also limited to the icons Excel provides in conditional formatting. 

2. As 1 is not possible, I would go with emoji.  you can go to https://emojipedia.org and search for the icons you want. Make sure to check the page of the emoji for the date the emoji was added, because if it was added months ago, it might not yet be supported everywhere.
The advantage of emoji is that you don't need to ship a different font to your users, they are installed by default in most modern machines. The disadvantage is that if you have users in unsupported versions of windows, they might not see them. Also, there is the possibility that Microsoft redraws the emoji some day, and your file will end up looking different.

3. You could use a font like font awesome or wingdings. The disadvantage in the case of font awesome is that if your user doesn't have it installed, he won't see the icons. You might have to install the font with your app. (wingdings or webdings should be ok as they are in every machine)

4. Finally, if none of the options above works, you will have to indeed add an image for each entry. This has the advantage of the user not having to have any particular font installed, and always looking as you designed it, because the fonts can redesign their icons in newer versions. the disadvantages as said are that the images don't really belong into any cell, and that they don't support hinting so they for example might not print right. If you make them 16x16 they will likely print pixelated when you print them at 600dpi. If you make them bigger resolution so they print fine, they will likely look blurry at 16x16 on the screen.

To add the images, you can indeed copy and paste them, but it is likely simpler to jus tuse FlexCelImport.AddPicture. What you do really is personal preference: You can have it in the template and copy it, or have it on disk and use AddPicture. My guess is that AddPicture is simpler because in FlexCel 3 you don't have a way to InsertAndCopyRange, so you need to copy the full row.

But it really depends on your needs and situation. If you can ensure your users have some font like font awesome installed, then that might be the solution. If you want a file that never changes no matter what, images are better for that.

Thanks for your advice, I am trying with the custom font.

Best regards