diff --git a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java index 08b32947e..26428593b 100644 --- a/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java +++ b/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java @@ -74,7 +74,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumns; @Beta public abstract class XDDFChart extends POIXMLDocumentPart { - /** * Underlying workbook */ @@ -456,6 +455,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart { && chartWorkbookRelation != null && chartFactory != null) { worksheetPart = createWorksheetPart(chartRelation, chartWorkbookRelation, chartFactory); + } else { + throw new InvalidFormatException("unable to determine chart relations"); } } try (OutputStream xlsOut = worksheetPart.getOutputStream()) { @@ -610,7 +611,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart { * @since POI 4.0.0 */ public String formatRange(CellRangeAddress range) { - return range.formatAsString(getSheet().getSheetName(), true); + final XSSFSheet sheet = getSheet(); + return (sheet == null) ? null : range.formatAsString(sheet.getSheetName(), true); } /** diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java index 35da6bf55..5b6c07954 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java @@ -87,7 +87,8 @@ public class XSLFGraphicFrame extends XSLFShape implements GraphicalFrame { @Override public XSLFTheme getTheme(){ - return getMasterSheet().getTheme(); + final XSLFNotesMaster m = getMasterSheet(); + return (m != null) ? m.getTheme() : null; } @Override diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java index 589f84e91..52cbc750a 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java @@ -258,12 +258,19 @@ public class XSLFTableCell extends XSLFTextShape implements TableCell