We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Reading Icon from Custom Icon Criteria Applied

How do i read the Icon & its IconSet Type if custom Icon Style Conditional Formatting is applied?


See the following sample code segments and write your own code to read conditional formattings results and attributes:
Sample code:

//Open a template Excel file
Workbook workbook = new Workbook(@“e:\test2\Testoutput.xlsx”);

        //Get the first worksheet in the workbook
        Worksheet sheet = workbook.Worksheets[0];

        //Get the A1 cell
        Cell cell = sheet.Cells["A1"];

        //Get the conditional formatting result object
        ConditionalFormattingResult cfr = cell.GetConditionalFormattingResult();
        //Get the icon set
        ConditionalFormattingIcon icon = cfr.ConditionalFormattingIcon;

        DataBar databar = cfr.ConditionalFormattingDataBar;
         //Create the image file based on the icon's image data
        File.WriteAllBytes("e:\\test2\\ff2icons.jpg", icon.ImageData);

//Instantiate Workbook object
Workbook workbook = new Workbook(“e:\test2\Book1.xlsx”);
Worksheet sheet = workbook.Worksheets[0];

  	ConditionalFormattingCollection cfs = sheet.ConditionalFormattings;

FormatConditionCollection fcs = cfs[0];
//Get first format condition.
FormatCondition fc = fcs[0];
//Get the Formula1
string f1 = fc.Formula1;
//Get the Formula2
string f2 = fc.Formula2;
//Get the operator type.
object op = fc.Operator;
//Get the format condition type.
object t = fc.Type;

Hope, this helps a bit.