How to Set Color for Data Labels by Name in PowerPoint Presentation in Java?

Hi Team
I have a requirement where in I am trying to set the color for the Datalabels and legends and I have only the name of the color (eg; black) but its giving null value since the setColor method is expecting Hexa value. Is there any Utils or methods in aspose slides which I can use to get the awt color if I provide the name as param?

portionFormat.getFillFormat().getSolidFillColor(). setColor(Color.getColor(newFont.getColor()));

I know we have something com.aspose.cells.Color.a in cells , similar to that do we have any utils for slides?

@mrajgopal.22,
Thank you for contacting support.

Unfortunately, I was unable to understand the problem. Could you please share a sample presentation and the simplest comprehensive code example that demonstrates the issue?

I am trying to set the SolidFillColor for the portionFormat , but i have only the name of the color (eg:black).Aspose slide is expecting java awt color object, do you have any Aspose slide utils which will give me awt color if i pass in the name of the color?

portionFormat.getFillFormat().getSolidFillColor(). setColor(Color.getColor(newFont.getColor()));

In aspose cells we have - com.aspose.cells.Color.a , where in if we pass the name it gives the aspose cells color object , which we can directly set , Do you have something similar for slides?

@mrajgopal.22,
Unfortunately, Aspose.Slides does not contain such a feature. As a workaround, you can use the Color class from Aspose.Cells.

Does the cells Color class have any method which will return java awt color , when we pass in color name as param

@mrajgopal.22,
It looks like the com.aspose.cells.Color class does not have a public method instead of the obfuscated com.aspose.cells.Color.a to do this.

1 Like

Thanks for the reply @Andrey_Potapov

@mrajgopal.22,
Thank you for using Aspose.Slides.