Aspose cell :how to extract the hex color code from a style.getBackgroundColor()?

I need to extract the hex value of the current BackgroundColor. I can see the values in the toString() output like

Aspose.Cells.Font [ Arial; 14.0; Italic; com.aspose.cells.Color@ff0000 ]
com.aspose.cells.Color@ffff00

How do I extract the Hex part ?

Hi,

Thanks for your posting and using Aspose.Cells.

Please see the following code, it first creates a Color, then print it using toString() method, then it gets the Color hexadecimal code. I have also shown the console output of the code for your reference.

Java


Color clr = Color.fromArgb(20, 19, 70);


System.out.println(clr.toString());


String hexaCode = Integer.toHexString(clr.getR()) + Integer.toHexString(clr.getG()) + Integer.toHexString(clr.getB());


System.out.println(hexaCode);


Console Output:
com.aspose.cells.Color@ff141346
141346

Perfect!

Now if you can just get my second question answered we will be all set.

Thanks
Rohit

Hi,

Thanks for your posting and using Aspose.Cells.

Please see my reply at your other thread for your reference.

( How do I extract the the "default excel style" from an excel workbook )