Conditional Formatting images

Hello

Is there exists a way for receive image for conditional formatted cells (see attached template)

Best regards. Alexey

Hi Alexey,

Thanks for your posting and using Aspose.Cells.

Yes it is possible to get the image of the icon from the conditional formatting result of the cell. Please see the following sample code. I have attached the output image generated by the code for your reference.

Java


String filePath = “F:\Shak-Data-RW\Downloads\markers.xlsx”;


//Create the workbook object

Workbook workbook = new Workbook(filePath);


//Access the first worksheet

Worksheet worksheet = workbook.getWorksheets().get(0);


//Access the cell

Cell cell = worksheet.getCells().get(“C7”);


//Get the conditioanl formatting result of this cell

ConditionalFormattingResult result = cell.getConditionalFormattingResult();


//Get the image data of this cell’s conditional formatting result

byte[] data = result.getConditionalFormattingIcon().getImageData();


//Write the image data to file

FileOutputStream fout = new FileOutputStream(“out.jpg”);

fout.write(data);

fout.close();

Thank you very much