Free Support Forum -

"no match found" exception when attempting to use addTextFrame

I'm trying to add text to an AutoShapeEx object, but the following code
throws an exception at the last line which reads "no match found":

PresentationEx presentation = new PresentationEx("c:\\myfile.pptx");
SlideEx coverSlide = presentation.getSlides().get(0);
ShapesEx coverShapes = coverSlide.getShapes();
int shapeIndex = coverShapes.addAutoShape(ShapeTypeEx.RECTANGLE, 10, 20, 30, 40);
AutoShapeEx ase = (AutoShapeEx)coverShapes.get(shapeIndex);

What is the problem?

Hi Peter,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your interest in Aspose.Slides.

Please use following code snippet to add text to a Text Frame.


//Instantiate PresentationEx class that represents PPTX

PresentationEx pres = new PresentationEx("d:\\ppt\\example.pptx");

SlideEx coverSlide = pres.getSlides().get(0);

//Printing the total number of slides in the presentation


//Fetcching all slide shapes

ShapesEx coverShapes = coverSlide.getShapes();

//Creating an auto shape

int shapeIndex = coverShapes.addAutoShape(ShapeTypeEx.RECTANGLE, 100, 200, 66, 64);

//Getting generated autoshape

AutoShapeEx ase = (AutoShapeEx)coverShapes.get(shapeIndex);


//Getting a text frame inside shape

com.aspose.slides.pptx.TextFrameEx tx=ase.getTextFrame();

//Accessing default paragraph and portion in text frame to add text.

tx.getParagraphs().get(0).getPortions().get(0).setText("Sample Text Here Sample Text Here Sample Text Here ");

//Writing to presentation

pres.write(new FileOutputStream("D:/ppt/ example.ppt") );


catch(Exception ex)




Thanks and Regards,