Hi,
Thanks for your interest in Aspose.Slides.
I have observed your requirements and suggest you to please try using following sample code to traverse through slide shapes and finding Title placeholder and its position on slide.
public static void ExtractPres()
{
//Loading the presentaiton
Presentation pres=new Presentation(“Test.ppt”);
//Accessing first slide
ISlide asposeSlide = pres.getSlides().get_Item(0);
//Getting all text boxes from slide
final ITextFrame[] allTextFrames = SlideUtil.getAllTextBoxes(asposeSlide);
IShape shape=null;
IAutoShape ashp=null;
//Traversing through all shapes
for(int i=0;i<asposeSlide.getShapes().size();i++)
{
shape=asposeSlide.getShapes().get_Item(0);
if(shape instanceof IAutoShape)
{
ashp=(IAutoShape)shape;
if(ashp.getPlaceholder().getType()==PlaceholderType.Title)
{
System.out.println(“Shape is Title Text Frame”);
}
if(ashp.getTextFrame()!=null)
{
ITextFrame textFrame=ashp.getTextFrame();
System.out.println(“TextFrame text=” + textFrame.getText());
//final Rectangle2D.Float paragraphRect = textFrame.getParagraphs().get_Item(0)…getRect();
System.out.println(“Position X=” +ashp.getX() + " Y=" + ashp.getY());
System.out.println(“Width=” +ashp.getWidth()+ " Height=" + ashp.getHeight());
System.out.println("");
}
}
}
}
Now, coming to your point regarding understanding of position value used by Aspose.Slides. Aspose.Slides use 72 pixels/inch as a units for slide size. So a normal slide with 10’’ x 7.5’’ is mapped with 720 x 540 in Aspose.Slides. The coordinates 0,0 corresponds to top left corner of slide and 720,540 corresponds to bottom right corner of slide. I hope this will be understandable now. Please share if any further help is needed in this regard.
Many Thanks,
Thank you very much for your quick reply, I will try your solution quickly.
Hi Muddssir,
Thanks for above code snippet. I want Similar one. But After getting required textframe and text of it as below code,
ITextFrame textFrame=ashp.getTextFrame();
System.out.println(“TextFrame text=” + textFrame.getText());
I am unable to update text (text is not getting updated in generated slides) by setting it to updated value by using below code
textFrame.setText(“Updated SubTitle”);
Please suggest.
Thanks
Manoj Dhawale
I have observed your comments. Can you please provide complete source code along with environment details and which Aspose.Slides version you are using on your end so that we may further investigate to help you out.
Thanks Adnan for Reply.
I this issue resolved. Actually updating text of textframe is not working. I have to extract portion object from paragraph object which in turns extracted from textframe.
Updating text of portion is visible on ppt.
Thanks
We are glad to know that things are working on your end. Please share feedback with us if there is still an issue.