--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java +++ a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java @@ -99,7 +99,8 @@ public abstract class XSLFShape implements Shape { @Override public String getShapeName(){ - return getCNvPr().getName(); + CTNonVisualDrawingProps nonVisualDrawingProps = getCNvPr(); + return nonVisualDrawingProps == null ? null : getCNvPr().getName(); } @Override --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTableRow.java +++ a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTableRow.java @@ -19,6 +19,7 @@ package org.apache.poi.xslf.usermodel; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -128,4 +129,22 @@ public class TestXSLFTableRow { assertNotNull(ctrow); } + @Test + public void getShapeNameOfCells() throws Exception { + try(XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("table_test.pptx")) { + for (XSLFSlide slide : ss1.getSlides()) { + for (XSLFShape shape : slide.getShapes()) { + shape.getShapeName(); + if (shape instanceof XSLFTable) { + for (XSLFTableRow row : ((XSLFTable) shape).getRows()) { + for (XSLFTableCell cell : row.getCells()) { + assertNull(cell.getShapeName()); // Do not throw NPE + } + } + } + } + } + } + } + }