Hi,
Please see the sample code below to accomplish your task (as per sample.xlsx) regarding conditional formattings for your reference for your needs:
Sample code:
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
ConditionalFormattingCollection cfs = sheet.ConditionalFormattings;
int index = cfs.Add();
FormatConditionCollection fcs = cfs[index];
//Set the conditional format range.
CellArea ca = new CellArea();
ca.StartRow = 0;
ca.EndRow = 10;
ca.StartColumn = 0;
ca.EndColumn = 0;
fcs.AddArea(ca);
//Add condition.
int conditionIndex = fcs.AddCondition(FormatConditionType.IconSet);
FormatCondition fc = fcs[0];
fc.IconSet.Type = IconSetType.Symbols3;
fc.IconSet.ShowValue = true;
fc.IconSet.Cfvos[1].Type = FormatConditionValueType.Number;
fc.IconSet.Cfvos[1].Value = 0;
fc.IconSet.Cfvos[2].Type = FormatConditionValueType.Number;
fc.IconSet.Cfvos[2].Value = 10;
Aspose.Cells.Cell c = sheet.Cells[“A1”];
c.PutValue(7);
//Save the Excel file
workbook.Save(@“e:\test2\outcondiformatting1.xlsx”);