Class OdfChartDocument

All Implemented Interfaces:
Closeable, AutoCloseable

public class OdfChartDocument extends OdfDocument
This class represents an empty ODF document , which will be in general embedded in an existing ODF (Spreadsheet) document.
  • Constructor Details

  • Method Details

    • newChartDocument

      public static OdfChartDocument newChartDocument() throws Exception
      Creates an empty charts document. *
      Note: ODF Chart documents are (with OOo 3.0) only used as embedded document and not used stand-alone.
      Returns:
      ODF charts document based on a default template
      Throws:
      Exception - - if the document could not be created
    • newChartTemplateDocument

      public static OdfChartDocument newChartTemplateDocument() throws Exception
      Creates an empty charts template. *
      Note: ODF Chart documents are (with OOo 3.0) only used as embedded document and not used stand-alone.
      Returns:
      ODF charts template based on a default template
      Throws:
      Exception - - if the template could not be created
    • loadDocument

      public static OdfChartDocument loadDocument(InputStream inputStream) throws Exception
      Creates an OdfChartDocument from the OpenDocument provided by a resource Stream.

      Since an InputStream does not provide the arbitrary (non sequentiell) read access needed by OdfChartDocument, the InputStream is cached. This usually takes more time compared to the other createInternalDocument methods. An advantage of caching is that there are no problems overwriting an input file.

      If the resource stream is not a ODF chart document, ClassCastException might be thrown.

      Parameters:
      inputStream - - the InputStream of the ODF chart document.
      Returns:
      the chart document created from the given InputStream
      Throws:
      Exception - - if the document could not be created.
    • loadDocument

      public static OdfChartDocument loadDocument(String documentPath) throws Exception
      Loads an OdfChartDocument from the provided path.

      OdfChartDocument relies on the file being available for read access over the whole lifecycle of OdfChartDocument.

      If the resource stream is not a ODF chart document, ClassCastException might be thrown.

      Parameters:
      documentPath - - the path from where the document can be loaded
      Returns:
      the chart document from the given path or NULL if the media type is not supported by ODFDOM.
      Throws:
      Exception - - if the document could not be created.
    • loadDocument

      public static OdfChartDocument loadDocument(File file) throws Exception
      Creates an OdfChartDocument from the OpenDocument provided by a File.

      OdfChartDocument relies on the file being available for read access over the whole lifecycle of OdfChartDocument.

      If the resource stream is not a ODF chart document, ClassCastException might be thrown.

      Parameters:
      file - - a file representing the ODF chart document.
      Returns:
      the chart document created from the given File
      Throws:
      Exception - - if the document could not be created.
    • getContentRoot

      public OfficeChartElement getContentRoot() throws Exception
      Get the content root of a chart document.
      Overrides:
      getContentRoot in class OdfDocument
      Returns:
      content root, representing the office:chart tag
      Throws:
      Exception - if the file DOM could not be created.
    • changeMode

      public void changeMode(OdfChartDocument.OdfMediaType mediaType)
      Changes the document to the given mediatype. This method can only be used to convert a document to a related mediatype, e.g. template.
      Parameters:
      mediaType - the related ODF mimetype