Free Support Forum - aspose.com

Slide Notes

Hi


I have problem retrieving one note from presentation. Here is my code:
Presentation presentation= new Presentation(inputStream);

Slides slides = presentation.getSlides();

Notes notes = slides.get(0).getNotes();

Paragraphs paragraphs = notes.getParagraphs();

for (int i = 0; i < paragraphs.size(); i++) {
System.out.println(paragraphs.get(i).getText());
}

If you open attached ppt file and go to View->Notes Page you will see note “Duration: 30 Minutes” that is not printed from code. I am using PowerPoint 2007.

Can you tell me how can I retrieve this note?

Thanks, Ivica.

Hello Ivica,

As you are using different shapes in the notes using Power Point 2007, you can save presentation into Power Point 2007 (pptx) format and use the following code to get text from all shapes in the notes.

try {

PresentationEx pres = new PresentationEx("d:\\ppt\\ivi\\notes-test\\notes-test1.pptx");

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

NotesSlideEx nt=sld.getNotesSlide();

for(int i=0;i<nt.getShapes().size();i++){

ShapeEx shp=nt.getShapes().get(i);

if( shp instanceof AutoShapeEx ){

AutoShapeEx ashp=(AutoShapeEx)shp;

TextFrameEx tf=ashp.getTextFrame();

if(tf!=null)

System.out.print(tf.getText());

}

if( shp instanceof GroupShapeEx ){

GroupShapeEx gshp=(GroupShapeEx)shp;

for(int j=0;j<gshp.getShapes().size();j++){

ShapeEx shp1=gshp.getShapes().get(j);

if( shp1 instanceof AutoShapeEx ){

AutoShapeEx ashp1=(AutoShapeEx)shp1;

TextFrameEx tf1=ashp1.getTextFrame();

if(tf1!=null)

System.out.print(tf1.getText());

}

}

}

}

} catch (IOException e) {

e.printStackTrace();

}

}