Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved. Copyright 2009, 2010 IBM. All rights reserved. Use is subject to license terms. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. You can also obtain a copy of the License at http://odftoolkit.org/docs/license.txt Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 
 package org.odftoolkit.simple;
 
 import java.io.File;
 
This class represents an empty ODF document , which will be in general embedded in an existing ODF (Spreadsheet) document.
 
 public class ChartDocument extends Document {
 
 	private static final String EMPTY_CHART_DOCUMENT_PATH = "/OdfChartDocument.odc";
This enum contains all possible media types of ChartDocument documents.
 
 	public enum OdfMediaType implements MediaType {
 
 		private final Document.OdfMediaType mMediaType;
 
 			this. = mediaType;
 		}

Returns:
the mediatype of this document
 
 		public String getMediaTypeString() {
 		}

Returns:
the ODF filesuffix of this document
 
 		public String getSuffix() {
 			return .getSuffix();
 		}

Parameters:
mediaType string defining an ODF document
Returns:
the according OdfMediatype encapuslating the given string and the suffix
 
 		public static Document.OdfMediaType getOdfMediaType(String mediaType) {
 			return Document.OdfMediaType.getOdfMediaType(mediaType);
 		}
 	}

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:
java.lang.Exception - if the document could not be created
 
 	public static ChartDocument newChartDocument() 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:
java.lang.Exception - if the template could not be created
 
	public static ChartDocument newChartTemplateDocument() throws Exception {
		return doc;
	}

Creates an ChartDocument from the OpenDocument provided by a resource Stream.

Since an InputStream does not provide the arbitrary (non sequentiell) read access needed by ChartDocument, 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:
java.lang.Exception - if the document could not be created.
	public static ChartDocument loadDocument(InputStream inputStreamthrows Exception {
		return (ChartDocument) Document.loadDocument(inputStream);
	}

Loads an ChartDocument from the provided path.

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

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 SIMPLE.
Throws:
java.lang.Exception - if the document could not be created.
	public static ChartDocument loadDocument(String documentPaththrows Exception {
		return (ChartDocument) Document.loadDocument(documentPath);
	}

Creates an ChartDocument from the OpenDocument provided by a File.

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

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:
java.lang.Exception - if the document could not be created.
	public static ChartDocument loadDocument(File filethrows Exception {
		return (ChartDocument) Document.loadDocument(file);
	}

To avoid data duplication a new document is only created, if not already opened. A document is cached by this constructor using the internalpath as key.
	protected ChartDocument(OdfPackage pkgString internalPathChartDocument.OdfMediaType odfMediaType) {
		super(pkginternalPathodfMediaType.mMediaType);
	}

Get the content root of a chart document.

Returns:
content root, representing the office:chart tag
Throws:
java.lang.Exception if the file DOM could not be created.
		return super.getContentRoot(OfficeChartElement.class);
	}

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
	public void changeMode(OdfMediaType mediaType) {
		setOdfMediaType(mediaType.mMediaType);
	}
		throw new UnsupportedOperationException("Chart document is not supported to hold table now.");
	}
New to GrepCode? Check out our FAQ X