|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.odftoolkit.odfdom.pkg.OdfPackageDocument
org.odftoolkit.odfdom.dom.OdfSchemaDocument
org.odftoolkit.odfdom.doc.OdfDocument
org.odftoolkit.odfdom.doc.OdfTextDocument
org.odftoolkit.simple.TextDocument
in Simple API.
public class OdfTextDocument
This class represents an empty ODF text document.
Nested Class Summary | |
---|---|
static class |
OdfTextDocument.OdfMediaType
Deprecated. This enum contains all possible media types of OdfSpreadsheetDocument documents. |
Nested classes/interfaces inherited from class org.odftoolkit.odfdom.doc.OdfDocument |
---|
OdfDocument.UnicodeGroup |
Nested classes/interfaces inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument |
---|
OdfSchemaDocument.OdfXMLFile |
Nested classes/interfaces inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument |
---|
OdfPackageDocument.Resource |
Field Summary |
---|
Fields inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument |
---|
mContentDom, mDocumentStyles, mMetaDom, mSettingsDom, mStylesDom |
Fields inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument |
---|
mDocumentMediaType, mDocumentPathInPackage, mPackage, ROOT_DOCUMENT_PATH |
Constructor Summary | |
---|---|
protected |
OdfTextDocument(OdfPackage pkg,
String internalPath,
OdfTextDocument.OdfMediaType odfMediaType)
Deprecated. To avoid data duplication a new document is only created, if not already opened. |
Method Summary | |
---|---|
OdfTextParagraph |
addText(String text)
Deprecated. Append text to the end of a text document. |
void |
changeMode(OdfTextDocument.OdfMediaType mediaType)
Deprecated. Changes the document to the given mediatype. |
OfficeTextElement |
getContentRoot()
Deprecated. Get the content root of a text document. |
static OdfTextDocument |
loadDocument(File file)
Deprecated. Creates an OdfTextDocument from the OpenDocument provided by a File. |
static OdfTextDocument |
loadDocument(InputStream inputStream)
Deprecated. Creates an OdfTextDocument from the OpenDocument provided by a resource Stream. |
static OdfTextDocument |
loadDocument(String documentPath)
Deprecated. Loads an OdfTextDocument from the provided path. |
OdfTextParagraph |
newParagraph()
Deprecated. Creates a new paragraph |
OdfTextParagraph |
newParagraph(String text)
Deprecated. Creates a new paragraph and append text |
static OdfTextDocument |
newTextDocument()
Deprecated. Creates an empty text document. |
static OdfTextDocument |
newTextDocument(OdfTextDocument.OdfMediaType mimeType)
Deprecated. Creates an empty text document. |
static OdfTextDocument |
newTextMasterDocument()
Deprecated. Creates an empty text master document. |
static OdfTextDocument |
newTextTemplateDocument()
Deprecated. Creates an empty text template. |
static OdfTextDocument |
newTextWebDocument()
Deprecated. Creates an empty text web. |
Methods inherited from class org.odftoolkit.odfdom.doc.OdfDocument |
---|
close, getLocale, getOdfMediaType, getOfficeMetadata, getTableByName, getTableList, getUnicodeGroup, loadDocument, loadDocument, loadSubDocument, loadSubDocuments, loadSubDocuments, loadTemplate, newImage, save, save, setLocale, setOdfMediaType, toString |
Methods inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument |
---|
getBaseURI, getContentDom, getContentStream, getDocumentStyles, getFileDom, getMasterPages, getMetaDom, getMetaStream, getOfficeMasterStyles, getOrCreateDocumentStyles, getSettingsDom, getSettingsStream, getStylesDom, getStylesStream, getTables, getXMLFilePath |
Methods inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument |
---|
flushDoms, getDocumentPath, getFileDom, getMediaTypeString, getPackage, insertDocument, isExternalReference, isRootDocument, normalizeDocumentPath, removeDocument, save, setMediaTypeString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected OdfTextDocument(OdfPackage pkg, String internalPath, OdfTextDocument.OdfMediaType odfMediaType) throws SAXException
SAXException
Method Detail |
---|
public static OdfTextDocument newTextDocument() throws Exception
Exception
- - if the document could not be createdpublic static OdfTextDocument newTextDocument(OdfTextDocument.OdfMediaType mimeType) throws Exception
Exception
- - if the document could not be createdpublic static OdfTextDocument newTextTemplateDocument() throws Exception
Exception
- - if the template could not be createdpublic static OdfTextDocument newTextMasterDocument() throws Exception
Exception
- - if the document could not be createdpublic static OdfTextDocument newTextWebDocument() throws Exception
Exception
- - if the document could not be createdpublic static OdfTextDocument loadDocument(InputStream inputStream) throws Exception
Since an InputStream does not provide the arbitrary (non sequentiell) read access needed by OdfTextDocument, 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 text document, ClassCastException might be thrown.
inputStream
- - the InputStream of the ODF text document.
Exception
- - if the document could not be created.public static OdfTextDocument loadDocument(String documentPath) throws Exception
OdfTextDocument relies on the file being available for read access over the whole lifecycle of OdfTextDocument.
If the resource stream is not a ODF text document, ClassCastException might be thrown.
documentPath
- - the path from where the document can be loaded
Exception
- - if the document could not be created.public static OdfTextDocument loadDocument(File file) throws Exception
OdfTextDocument relies on the file being available for read access over the whole lifecycle of OdfTextDocument.
If the resource stream is not a ODF text document, ClassCastException might be thrown.
file
- - a file representing the ODF text document.
Exception
- - if the document could not be created.public OfficeTextElement getContentRoot() throws Exception
getContentRoot
in class OdfDocument
Exception
- if the file DOM could not be created.public OdfTextParagraph newParagraph(String text) throws Exception
text
-
Exception
- if the file DOM could not be created.public OdfTextParagraph newParagraph() throws Exception
Exception
- if the file DOM could not be created.public OdfTextParagraph addText(String text) throws Exception
text
- initial text for the paragraph.
Exception
- if the file DOM could not be created.public void changeMode(OdfTextDocument.OdfMediaType mediaType)
mediaType
- the related ODF mimetype
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |