Class OdfSpreadsheetDocument
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThis enum contains all possible media types of OdfSpreadsheetDocument documents.Nested classes/interfaces inherited from class org.odftoolkit.odfdom.doc.OdfDocument
OdfDocument.UnicodeGroupNested classes/interfaces inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument
OdfSchemaDocument.OdfXMLFileNested classes/interfaces inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument
OdfPackageDocument.Resource -
Field Summary
Fields inherited from class org.odftoolkit.odfdom.doc.OdfDocument
mHasCollaborationFields inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument
mContentDom, mJsonOperationQueue, mMetaDom, mSettingsDom, mStylesDomFields inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument
mDocumentMediaType, mDocumentPathInPackage, mPackage, ROOT_DOCUMENT_PATH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOdfSpreadsheetDocument(OdfPackage pkg, String internalPath, OdfSpreadsheetDocument.OdfMediaType odfMediaType) To avoid data duplication a new document is only created, if not already opened. -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeMode(OdfSpreadsheetDocument.OdfMediaType mediaType) Changes the document to the given mediatype.Get the content root of a spreadsheet document.Return a list of table features in this document.static OdfSpreadsheetDocumentloadDocument(File file) Creates an OdfSpreadsheetDocument from the OpenDocument provided by a File.static OdfSpreadsheetDocumentloadDocument(InputStream inputStream) Creates an OdfSpreadsheetDocument from the OpenDocument provided by a resource Stream.static OdfSpreadsheetDocumentloadDocument(String documentPath) Loads an OdfSpreadsheetDocument from the provided path.static OdfSpreadsheetDocumentCreates an empty spreadsheet document.static OdfSpreadsheetDocumentCreates an empty spreadsheet template.Methods inherited from class org.odftoolkit.odfdom.doc.OdfDocument
addAnnotation, close, getAnnotation, getFontNames, getLocale, getOdfMediaType, getOfficeMetadata, getSelectionManager, getTableByName, getTableList, getTableList, getUnicodeGroup, getUniqueAnnotationName, hasCollaboration, loadDocument, loadDocument, loadDocument, loadDocument, loadDocument, loadDocument, loadDocument, loadSubDocument, loadSubDocuments, loadSubDocuments, loadTemplate, loadTemplate, newImage, removeAnnotation, removeCachedView, save, save, setLocale, setOdfMediaType, toString, updateMetaDataMethods inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument
getBaseURI, getBookmarkRDFMetadata, getContentDom, getContentStream, getDocumentStyles, getFileDom, getInContentMetadata, getInContentMetadataFromCache, getJsonOperationQueue, getManifestRDFMetadata, getMasterPages, getMetaDom, getMetaStream, getOfficeMasterStyles, getOperations, getOrCreateDocumentStyles, getRDFMetadata, getRootComponent, getRootComponentElement, getSettingsDom, getSettingsStream, getStyleByDisplayName, getStyleByName, getStylesDom, getStylesStream, getTables, getTables, getXMLFilePath, setContentDom, setJsonOperationQueue, setMetaDom, setRootComponent, setSettingsDom, setStylesDomMethods inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument
flushDoms, getAbsoluteFilePath, getCachedDom, getDocumentPath, getFileDom, getMediaTypeString, getPackage, getXMLFileMetadata, insertDocument, isExternalReference, isRootDocument, normalizeDocumentPath, removeDocument, save, setMediaTypeString
-
Constructor Details
-
OdfSpreadsheetDocument
protected OdfSpreadsheetDocument(OdfPackage pkg, String internalPath, OdfSpreadsheetDocument.OdfMediaType odfMediaType) throws SAXException 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.- Throws:
SAXException
-
-
Method Details
-
newSpreadsheetDocument
Creates an empty spreadsheet document.- Returns:
- ODF spreadsheet document based on a default template*
- Throws:
Exception- - if the document could not be created
-
newSpreadsheetTemplateDocument
Creates an empty spreadsheet template.- Returns:
- ODF spreadsheet template based on a default
- Throws:
Exception- - if the template could not be created
-
loadDocument
Creates an OdfSpreadsheetDocument from the OpenDocument provided by a resource Stream.Since an InputStream does not provide the arbitrary (non sequentiell) read access needed by OdfSpreadsheetDocument, 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 spreadsheet document, ClassCastException might be thrown.
- Parameters:
inputStream- - the InputStream of the ODF spreadsheet document.- Returns:
- the spreadsheet document created from the given InputStream
- Throws:
Exception- - if the document could not be created.
-
loadDocument
Loads an OdfSpreadsheetDocument from the provided path.OdfSpreadsheetDocument relies on the file being available for read access over the whole lifecycle of OdfSpreadsheetDocument.
If the resource stream is not a ODF spreadsheet document, ClassCastException might be thrown.
- Parameters:
documentPath- - the path from where the document can be loaded- Returns:
- the spreadsheet 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
Creates an OdfSpreadsheetDocument from the OpenDocument provided by a File.OdfSpreadsheetDocument relies on the file being available for read access over the whole lifecycle of OdfSpreadsheetDocument.
If the resource stream is not a ODF spreadsheet document, ClassCastException might be thrown.
- Parameters:
file- - a file representing the ODF spreadsheet document.- Returns:
- the spreadsheet document created from the given File
- Throws:
Exception- - if the document could not be created.
-
getContentRoot
Get the content root of a spreadsheet document.- Overrides:
getContentRootin classOdfDocument- Returns:
- content root, representing the office:spreadsheet tag
- Throws:
Exception- if the file DOM could not be created.
-
changeMode
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
-
getSpreadsheetTables
Return a list of table features in this document. For general ODF documents it searches for them recursively through the document. For ODF documents, there is a getOdsTableList- Returns:
- a list of table features in this document.
-