Hi,
I have a simple powerpoint with two pieces of curved word art text. I am trying to write Java code to edit the text and wish to retain all the formatting so that the result is identical except that the text is different.
Attached is the source (wordart.pptx) and the result out.pptx you can see the result looks quite different. I tried changing the size and location of the boxes programatically but that doesn’t seem to take affect - the text boxes are too short and that makes the text curve wrong.
Here is my code:
Presentation wordArtTemplate = new Presentation("c:\\wordart.pptx");
ISlide s = myPres.getSlides().addClone(wordArtTemplate.getSlides().get_Item(0));
((IAutoShape)s.findShapeByAltText("TOP_CURVE_DOWN_TEXT")).getTextFrame().getParagraphs().get_Item(0).setText("XXXXXXXXXXXXXXXXXX");
((IAutoShape)s.findShapeByAltText("TOP_CURVE_DOWN_TEXT")).setHeight(Utils.getPixelValue(21.26f));
((IAutoShape)s.findShapeByAltText("TOP_CURVE_DOWN_TEXT")).setY(Utils.getPixelValue(2.68f));
((IAutoShape)s.findShapeByAltText("BOTTOM_CURVE_UP_TEXT")).getTextFrame().getParagraphs().get_Item(0).setText("YYYYYYYYYYYYYYYYYYYYYY");
((IAutoShape)s.findShapeByAltText("BOTTOM_CURVE_UP_TEXT")).setHeight(Utils.getPixelValue(3.88f));
((IAutoShape)s.findShapeByAltText("BOTTOM_CURVE_UP_TEXT")).setY(Utils.getPixelValue(5.98f));
public static float getPixelValue(float cmValue) {
float retVal = cmValue/2.54f*72f;
return retVal;
}
Any clues to a work-around would be gratefully received.
wordart.zip (65.5 KB)
Many thanks,
Andy