Free Support Forum -

How to extract text from a presentation into a file


I am using Aspose Slides v15.6.0
We have the requirement of extracting text from the entire presentation into a file.
I am using the below approach of extracting text from each shape.
Is there any other appropriate and general way of extracting text from presentation that includes text from text boxes, shapes, smart art, table etc…
private void writeTextContentOfWorkbook(final Presentation presentation, final String textFilePath) throws IOException {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(new File(textFilePath)));
for (int index = 0; index < presentation.getSlides().size(); index++){
Slide slide = (Slide) presentation.getSlides().get_Item(index);
ShapeCollection shapes = (ShapeCollection) slide.getShapes();

for (int i = 0; i < shapes.size(); i++) {
Shape shape = (Shape) shapes.get_Item(i);

if (shape instanceof AutoShape) {
writeAutoShape(writer, (AutoShape) shape);
} else if (shape instanceof GroupShape) {
GroupShape ggroupShapes = (GroupShape) shape;
for (int j = 0; j < ggroupShapes.getShapes().size(); j++) {
if (ggroupShapes.getShapes().get_Item(j) instanceof AutoShape) {
writeAutoShape(writer, (AutoShape) ggroupShapes.getShapes().get_Item(j));
} else if (shape instanceof Table) {
Table tTable = (Table) shape;
for (int iCol = 0; iCol < tTable.getColumns().size(); iCol++) {
for (int iRow = 0; iRow < tTable.getRows().size(); iRow++) {
writeText(writer, (TextFrame) tTable.get_Item(iCol, iRow).getTextFrame());
} finally {

Jaspreet Kaur


Your query/issue looks to relate to Aspose.Slides component, so I am moving your thread to Aspose.Slides forum where one of may fellow colleagues from Aspose.Slides team will help you soon there.

Thank you.

Hi Jaspreet,

Thank you for considering Aspose.Slides.

I have observed your comments and like to request you to please visit this link for your kind reference.

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,