Instance of Table

Hello,
can you please check this:

Attached file(Presentation1.ptt) have a table but when iterate trough the Shapes with follewed code:

public class TableTest {
@Test
public void tableTest() {
InputStream inputStream = getClass().getClassLoader()
.getResourceAsStream(
"org/gs4tr/filters3/msoffice/ppt/Presentation1.ppt");
Presentation presentation = new Presentation(inputStream);
Slide slide = presentation.getSlideByPosition(1);
for (int i = 0; i < slide.getShapes().size(); i++) {
if (slide.getShapes().get(i) instanceof Table) {
System.out.println("Table Found");
break;
}
}
}
}

does not recognize "instanceof Table".

thank's,
Bojan


I am so sorry for wrong code,

this is code for you:

public class TableTest {

public void tableTest() {
try {
Presentation presentation = new Presentation(new FileInputStream(
new File(“d:/Bojan/Presentation1.ppt”)));
Slide slide = presentation.getSlideByPosition(1);
for (int i = 0; i < slide.getShapes().size(); i++) {
if (slide.getShapes().get(i) instanceof Table) {
System.out.println(“Table Found”);
break;
}
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
}

Thank’s,
Bojan

Hi Bojan,


I have investigated the presenation and code snippet shared. I have observed that slide contain table but that table has been created in Ms Excel and added as Ole object inside presentation. Aspose.Slides rightly reads the shape as instance of OleObjectFrame. It is in fact not an issue. Hope it clear the concept for you. Please use the following IF condition.


if (shp instanceof OleObjectFrame)


Many Thanks,