GraphicsDocument extends Document { public static GraphicsDocument loadDocument(InputStream inputStream) throws Exception { return (GraphicsDocument) Document.loadDocument(inputStream); } protected  GraphicsDocument(OdfPackage pkg, String internalPath, GraphicsDocument.OdfMediaType odfMediaType); static GraphicsDocument newGraphicsDocument(); static GraphicsDocument newGraphicsTemplateDocument(); static GraphicsDocument loadDocument(InputStream inputStream); static GraphicsDocument loadDocument(String documentPath); static GraphicsDocument loadDocument(File file); @Override OfficeDrawingElement getContentRoot(); void changeMode(OdfMediaType mediaType); OdfElement getTableContainerElement();  }
@Test public void testLoadingAChartTemplate() throws Exception { try { GraphicsDocument graphiDoc = GraphicsDocument.loadDocument(ResourceUtilities.getAbsolutePath(TEST_FILE)); Assert.assertNotNull(graphiDoc); Document.OdfMediaType graphiType = graphiDoc.getOdfMediaType(); Assert.assertTrue(graphiType.equals(Document.OdfMediaType.GRAPHICS_TEMPLATE)); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } }
@Test public void testLoadDocumentPath() throws Exception { try { String filePath = ResourceUtilities.getAbsolutePath(TEST_FILE); GraphicsDocument gdoc = GraphicsDocument.loadDocument(filePath); Assert.assertNotNull(gdoc); Assert.assertEquals("application/vnd.oasis.opendocument.graphics-template", gdoc.getMediaTypeString()); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } }
@Test public void testLoadDocumentFile() throws Exception { try { String filePath = ResourceUtilities.getAbsolutePath(TEST_FILE); File otg = new File(filePath); GraphicsDocument gdoc = GraphicsDocument.loadDocument(otg); Assert.assertNotNull(gdoc); Assert.assertEquals("application/vnd.oasis.opendocument.graphics-template", gdoc.getMediaTypeString()); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } }
@Test public void testLoadDocumentStream() throws Exception { try { String filePath = ResourceUtilities.getAbsolutePath(TEST_FILE); File otg = new File(filePath); FileInputStream fStream = new FileInputStream(otg); GraphicsDocument gdoc = GraphicsDocument.loadDocument(fStream); Assert.assertNotNull(gdoc); Assert.assertEquals("application/vnd.oasis.opendocument.graphics-template", gdoc.getMediaTypeString()); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } }