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

Free Support Forum - aspose.com

Reading words from Diagrams

Hi Aspose-Team

we are using your Aspose.slides for Java and we find out that the system is not reading the words in diagrams and in grouped text fields. We are collecting these words in all slides for the search function to find these slides quickly.

We are wondering, if the system is not supporting it. Or is it an issue by reading the slides in PPTX or in PPT

Regards
Alex

Dear Alex,

I have tried to understand the problem specified by you. It would be really convenient for us, if you may please share the source presentation with us, so that we may investigate and help you out. You may please also visit article1 and article2 as it may prove helpful for you.

Thanks and Regards,

I uploaded the presentation with 2 slides. One with a diagram and the other with grouped text fields.

We are unable to get the texts out of these objects. From the first slide for example “2007” and from the other slides the other objects.

Regards
Alex

Dear Alex,

I have written the code snippet for you in order to extract the text from the Group Shapes. Please use the code snippet given below and please share your findings with us, if you may feel any issue while using the code snippet. As far as text inside Ole Frame in Slide 1 is related, unfortunately it is not possible to extract the text from that.

//Opening presentation
Presentation pres=new Presentation("D:\\Aspose Data\\Kundenwachstum.ppt");

//iterate selected slides
int lastSlidePosition = pres.getSlides().getLastSlidePosition();

for (int pos = 1; pos <= lastSlidePosition; pos++)
{
Slide sld = pres.getSlideByPosition(pos);
//iterate all shapes
int shapesCount = sld.getShapes().size();

for (int shpIdx = 0; shpIdx < shapesCount; shpIdx++)
{
com.aspose.slides.Shape shp=sld.getShapes().get(shpIdx);

//Get the paragraphs from textholder or textframe
Paragraphs paras = null;
//Check if shape holds a textholder
if(shp instanceof com.aspose.slides.GroupShape)
{
//Type casting shape to group shape
com.aspose.slides.GroupShape gShape = (com.aspose.slides.GroupShape)shp;
//Traversing through all shapes in group shape
for (int iCount=0;iCount< gShape.getShapes().size();iCount++)
{
com.aspose.slides.Shape sh=gShape.getShapes ().get(iCount);
if(sh instanceof Rectangle)
{
if (sh.getPlaceholder() != null && sh.isTextHolder())
{
Object obj = sh.getPlaceholder();
if(obj instanceof TextHolder)
{
TextHolder txtHolder = (TextHolder)obj;
paras = txtHolder.getParagraphs();
System.out.println("Text Holder::::::"+txtHolder.getText ());
}
else if(obj instanceof Placeholder)
{
Placeholder placeHolder = (Placeholder)obj;
paras = placeHolder.getShapeRef().getTextFrame().getParagraphs();
System.out.println("Text Holder::::::"+placeHolder.getShapeRef().getTextFrame().getText ());
}
}
else
{
if (sh.getTextFrame() != null)
{
paras = sh.getTextFrame().getParagraphs();
System.out.println("Text Holder::::::"+sh.getTextFrame().getText ());

}
}

}

}

}

}//end for

}//end for

Thanks and Regards,

Hi

Your msg> As far as text inside Ole Frame in Slide 1 is related, unfortunately it
Your msg> is not possible to extract the text from that.
is it possible to read this text out of PPTX. The presentation I uploaded is PPT. So if you convert this into PPTX, then is it possible to read the text out the ole objects or diagrams?

Regards
Alex

Dear Alex,

Yes you may extract the entire text from PPTX presentation as well. Please use the code sample given here as it fulfills the exact requirements mentioned by you.

Thanks and Regards,