Free Support Forum -

Trouble copying ColorFormat between TextPortions


I’m wondering whether I’m facing a bug. I’m trying to apply the same font settings (color too) as an original TextPortion for newly created TextPortions. I’m doing it like this:

ColorFormatEx referenceSolidFillColor = referenceFillFormat.getSolidFillColor();
ColorFormatEx solidFillColor = newFillFormat.getSolidFillColor();
applyColorFormatEx(referenceSolidFillColor, solidFillColor);

private void applyColorFormatEx(ColorFormatEx referenceColorFormat, ColorFormatEx newColorFormat) {
int referenceColorType = referenceColorFormat.getColorType();
if (referenceColorType > -1) {

Strangely, the color does not appear to be the same. When I print logging information about the two formats, this is obvious: Original RGB seems to be transformed into GBR:

Prinitng original Color :
getColorType(): 0
getR(): 122
getG(): -110
getB(): 24
getFloatR(): 0.47843137
getFloatG(): 0.57254905
getFloatB(): 0.09411765
getColor(): java.awt.Color[r=122,g=146,b=24]
getHue(): 311.80328
getLuminance(): 0.33333334
getSaturation(): 0.7176471
getPresetColor(): -1
getSchemeColor(): -1
getSystemColor(): -1
Prinitng reference Color :
getColorType(): 2
getR(): -110
getG(): 24
getB(): 122
getFloatR(): 0.57254905
getFloatG(): 0.09411764
getFloatB(): 0.47843134
getColor(): java.awt.Color[r=146,g=24,b=122]
getHue(): 311.80328
getLuminance(): 0.33333334
getSaturation(): 0.7176471
getPresetColor(): -1
getSchemeColor(): -1
getSystemColor(): -1

This is why in my generated PPTX I have purple instead of green text. :slight_smile:
Could you verify?

Hi Christian,

I have observed the code snippet shared by you but unfortunately have not been able to completely understand it. Please proceed to this documentation link where I have created article for copying Paragraph and Portion properties for PPTX. Please use the sample code shared there. If there is still an issue then please share the complete sample application along with source presentation and generated presentation with us. I will investigate the issue further to help you out.

Many Thanks,