|
||||||||||
| 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.simple.Document
org.odftoolkit.simple.TextDocument
public class TextDocument
This class represents an empty ODF text document.
| Nested Class Summary | |
|---|---|
static class |
TextDocument.OdfMediaType
This enum contains all possible media types of SpreadsheetDocument documents. |
| Nested classes/interfaces inherited from class org.odftoolkit.simple.Document |
|---|
Document.ScriptType |
| 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 |
TextDocument(OdfPackage pkg,
String internalPath,
TextDocument.OdfMediaType odfMediaType)
To avoid data duplication a new document is only created, if not already opened. |
| Method Summary | |
|---|---|
List |
addList()
Add a new List to this container. |
List |
addList(ListDecorator decorator)
Add a List with specified ListDecorator to this container. |
OdfTextParagraph |
addText(String text)
Append text to the end of a text document. |
Section |
appendSection(Section section,
boolean isResourceCopied)
Copy a section and append it at the end of the text document, whether the section is in this document or in a different document. |
void |
changeMode(TextDocument.OdfMediaType mediaType)
Changes the document to the given mediatype. |
void |
clearList()
Remove all Lists from this container. |
OfficeTextElement |
getContentRoot()
Get the content root of a text document. |
OdfElement |
getListContainerElement()
Get the ODF element which can have |
Iterator<List> |
getListIterator()
Return an Iterator of the Lists in this ListContainer. |
static TextDocument |
loadDocument(File file)
Creates an TextDocument from the OpenDocument provided by a File. |
static TextDocument |
loadDocument(InputStream inputStream)
Creates an TextDocument from the OpenDocument provided by a resource Stream. |
static TextDocument |
loadDocument(String documentPath)
Loads an TextDocument from the provided path. |
OdfTextParagraph |
newParagraph()
Creates a new paragraph |
OdfTextParagraph |
newParagraph(String text)
Creates a new paragraph and append text |
static TextDocument |
newTextDocument()
Creates an empty text document. |
static TextDocument |
newTextDocument(TextDocument.OdfMediaType mimeType)
Creates an empty text document. |
static TextDocument |
newTextMasterDocument()
Creates an empty text master document. |
static TextDocument |
newTextTemplateDocument()
Creates an empty text template. |
static TextDocument |
newTextWebDocument()
Creates an empty text web. |
boolean |
removeList(List list)
Remove the existing List from this container. |
| Methods inherited from class org.odftoolkit.simple.Document |
|---|
close, getContentRoot, getEmbeddedDocument, getEmbeddedDocuments, getEmbeddedDocuments, getLocale, getOdfMediaType, getOfficeMetadata, getScriptType, getSectionByName, getSectionIterator, getTableBuilder, getTableByName, getTableList, insertDocument, loadDocument, loadDocument, loadTemplate, newImage, removeElementLinkedResource, save, save, setLocale, setLocale, setOdfMediaType, toString |
| Methods inherited from class org.odftoolkit.odfdom.dom.OdfSchemaDocument |
|---|
getBaseURI, getContentDom, getContentStream, getDocumentStyles, getFileDom, getMetaDom, getMetaStream, getOfficeMasterStyles, getOrCreateDocumentStyles, getSettingsDom, getSettingsStream, getStylesDom, getStylesStream, getXMLFilePath |
| Methods inherited from class org.odftoolkit.odfdom.pkg.OdfPackageDocument |
|---|
flushDoms, getDocumentPath, getFileDom, getMediaTypeString, getPackage, isExternalReference, isRootDocument, loadSubDocument, normalizeDocumentPath, removeDocument, save, setMediaTypeString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected TextDocument(OdfPackage pkg,
String internalPath,
TextDocument.OdfMediaType odfMediaType)
| Method Detail |
|---|
public static TextDocument newTextDocument()
throws Exception
Exception - - if the document could not be created
public static TextDocument newTextDocument(TextDocument.OdfMediaType mimeType)
throws Exception
Exception - - if the document could not be created
public static TextDocument newTextTemplateDocument()
throws Exception
Exception - - if the template could not be created
public static TextDocument newTextMasterDocument()
throws Exception
Exception - - if the document could not be created
public static TextDocument newTextWebDocument()
throws Exception
Exception - - if the document could not be created
public static TextDocument loadDocument(InputStream inputStream)
throws Exception
Since an InputStream does not provide the arbitrary (non sequentiell) read access needed by TextDocument, 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 TextDocument loadDocument(String documentPath)
throws Exception
TextDocument relies on the file being available for read access over the whole lifecycle of TextDocument.
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 TextDocument loadDocument(File file)
throws Exception
TextDocument relies on the file being available for read access over the whole lifecycle of TextDocument.
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 DocumentException - 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(TextDocument.OdfMediaType mediaType)
mediaType - the related ODF mimetype
public Section appendSection(Section section,
boolean isResourceCopied)
The IDs and names in this section would be changed to ensure unique.
If the section contains a linked resource, isResourceCopied
would specify whether the linked resource would be copied or not, when
the copy and append happens within a same document.
section - - the section objectisResourceCopied - - whether the linked resource is copied or not.public OdfElement getListContainerElement()
ListContainer
getListContainerElement in interface ListContainerpublic List addList()
ListContainer
addList in interface ListContainerpublic List addList(ListDecorator decorator)
ListContainer
addList in interface ListContainerdecorator - the specified ListDecorator
public void clearList()
ListContainer
clearList in interface ListContainerpublic Iterator<List> getListIterator()
ListContainer
getListIterator in interface ListContainerIteratorpublic boolean removeList(List list)
ListContainer
removeList in interface ListContainer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||