We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Editing curved word art text results in wrong layout

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

@andysteady,

I have observed your comments. Can you please share complete working sample project along with environment details so that we may further investigate to help you out. Also please share which Aspose.Slides version you are using on your end.

Hi,

It’s Java aspose for slides 18.9 running from Windows 10

Attached is Java, the input file and the output file.

wordartproject.zip (66.2 KB)

Thanks,
Andy

@andysteady,

I have observed your comments. Can you please try to use below sample code. This will help you to achieve your requirements. I have also shared my generated result with you. Please check attachment. Please share feedback with us if there is still an issue.
wordartresult.zip (40.0 KB)

Presentation myPres = new Presentation(path+“samp.pptx”);
myPres.getSlides().removeAt(0);
Presentation wordArtTemplate = new Presentation(path+“wordart.pptx”);
ISlide s = myPres.getSlides().addClone(wordArtTemplate.getSlides().get_Item(0));

IAutoShape shape = ((IAutoShape)s.findShapeByAltText(“TOP_CURVE_DOWN_TEXT”));
shape.getTextFrame().getTextFrameFormat().setAutofitType(TextAutofitType.None);
shape.getTextFrame().setText(“11XXXXXXXXXXXXXXXXXX”);

IAutoShape shape1 = ((IAutoShape)s.findShapeByAltText(“BOTTOM_CURVE_UP_TEXT”));
shape1.getTextFrame().getTextFrameFormat().setAutofitType(TextAutofitType.None);
shape1.getTextFrame().getParagraphs().get_Item(0).setText(“22YYYYYYYYYYYYYYYYYYYYYY”);

myPres.save(path+“wordartresult.pptx”, SaveFormat.Pptx);

}

Brilliant thank you that worked great!