CTSRgbColor Value??
Posted: Mon Aug 03, 2015 7:12 pm
Hi all,
first of all let me thank you for making this awesome library and keep improving it
Ok, now let's talk about my question.
I'm working on a program that will let user export some documents in PPTX format and everything seems to work fine, but I don't know how to color a text. I saw some Pptx documents to see how it Works and after that I upload the document to get the auto-generated code, but it shows an error on the strange part:
In the Pptx docs the code is like this:
Original Code
PPTX4J Code
As you can see, the srgbClr val property have a String but in Pptx4j API Val property gets a byte Array, so I tried to call rgbColor.getBytes() but that's not the way(the pptx crashes after that because there is a very large number). I think is a library problem, but it's not my library so could you please tell me how to make this work?
Thank you for all your work
first of all let me thank you for making this awesome library and keep improving it
Ok, now let's talk about my question.
I'm working on a program that will let user export some documents in PPTX format and everything seems to work fine, but I don't know how to color a text. I saw some Pptx documents to see how it Works and after that I upload the document to get the auto-generated code, but it shows an error on the strange part:
In the Pptx docs the code is like this:
Original Code
- Code: Select all
<a:r>
<a:rPr lang="es-ES_tradnl" sz="800" b="1" dirty="0" err="1" smtClean="0">
<a:solidFill>
<a:srgbClr val="FF0000"/>
</a:solidFill>
</a:rPr>
<a:t>Caracterizaci</a:t>
</a:r>
PPTX4J Code
- Code: Select all
// RED Color
String rgbColor = "FF0000";
CTTextCharacterProperties textCharacterProperties = regulartextrun.getRPr();
if (textCharacterProperties == null) {
textCharacterProperties = dmlFactory.createCTTextCharacterProperties();
regulartextrun.setRPr(textCharacterProperties);
}
CTSolidColorFillProperties solidColorFillProperties = dmlFactory.createCTSolidColorFillProperties();
CTSRgbColor ctSolidRgbColor = dmlFactory.createCTSRgbColor();
ctSolidRgbColor.setVal(rgbColor.getBytes());
solidColorFillProperties.setSrgbClr(ctSolidRgbColor);
textCharacterProperties.setSolidFill(solidColorFillProperties);
As you can see, the srgbClr val property have a String but in Pptx4j API Val property gets a byte Array, so I tried to call rgbColor.getBytes() but that's not the way(the pptx crashes after that because there is a very large number). I think is a library problem, but it's not my library so could you please tell me how to make this work?
Thank you for all your work