facebooktwittermenuarrow-up

GemBox Support Forum

Cannot setup custom icons in icon set conditional formatting

Hello,

I tried to setup custom icons for icon set conditional formatting but the icons are not changed after saving the XLSX file.

Also I didn’t find any information or examples about how to setup custom icon set, so I had to spend a lot of time to understand how it can be configured. It would be nice to have some documentation with examples regarding that.

Am I doing something wrong?

Code:

// Apply 'Icon Set' conditional formatting to 'Years of Service' column.
IconSetCondition iconSetCondition = worksheet.ConditionalFormatting.AddIconSet("C2:C" + (rowCount + 1));

iconSetCondition.IconStyle = SpreadsheetIconStyle.FourTrafficLights;

iconSetCondition.Icons[3].Icon = new SpreadsheetIcon(SpreadsheetIconStyle.ThreeSymbolsCircled, id: 0);
iconSetCondition.Icons[3].Value = ConditionalValue.FromNumber(30);

iconSetCondition.Icons[2].Icon = new SpreadsheetIcon(SpreadsheetIconStyle.ThreeSymbolsCircled, id: 1);
iconSetCondition.Icons[2].Value = ConditionalValue.FromNumber(20);

iconSetCondition.Icons[1].Icon = new SpreadsheetIcon(SpreadsheetIconStyle.ThreeSymbolsCircled, id: 2);
iconSetCondition.Icons[1].Value = ConditionalValue.FromNumber(10);

iconSetCondition.Icons[0].Icon = new SpreadsheetIcon(SpreadsheetIconStyle.FourRedToBlack, id: 1);
iconSetCondition.Icons[0].Value = ConditionalValue.FromNumber(0);

Hi Oleksii,

Please try again with this bugfix:
https://www.gemboxsoftware.com/spreadsheet/nightlybuilds/GBS47v1318.zip

Or this NuGet package:
Install-Package GemBox.Spreadsheet -Version 47.0.1318-hotfix

Does this solve your issue?

Regards,
Mario

Yes, it works for me, thanks. When will this fix be released?

And one more thing to improve. I noticed that if you specify cells from multiple columns in the AddIconSet method (e.g., “A11:A21,B11:B21,C11:C21”) it will break the whole document. It doesn’t block me but it would be nice to have this working.

The new public bugfix release should be made by the end of this week or at the start of the next.

Regarding the issue, try replacing the commas with spaces, e.g. use this:

IconSetCondition iconSetCondition = worksheet.ConditionalFormatting
    .AddIconSet("A11:A21 B11:B21 C11:C21");

I hope this helps.

Yes, it helped, thanks.