Free Support Forum -

How to give gradient color to text

Hi All
Can you plz help me to set text color as gradient color in slides.
I am written following code but it’s not working can u help me to solve this?

port = ashape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0);
// Set the Gradient Direction
// Add two Gradient Stops
port.getPortionFormat().getFillFormat().getGradientFormat().getGradientStops().add(0.5f, Color.GREEN);
port.getPortionFormat().getFillFormat().getGradientFormat().getGradientStops().add(0.5f, Color.CYAN);


I have observed the requirements and code sample portion that you have shared also seems to be fine. Can you please share the details of requirements in the form of desired output presentation and working sample code. We will be able to investigate the issue further on our end on provision of requested information.

Thanks I added textframe and set text in that and then try to give gradient color then it’s work for me. I thing to give gradient color to text we have to select the text from textframe or shape then it’s work. :slight_smile:


It’s good to know things are working fine your end. Please share if I may help you further in this regard.