Package com.independentsoft.office.odf
Class TextDocument
java.lang.Object
com.independentsoft.office.odf.Document
com.independentsoft.office.odf.TextDocument
The Class TextDocument.
-
Field Summary
Fields inherited from class com.independentsoft.office.odf.Document
commonStyles, customFileTable, inputFileTable, isTemplate, manifest, metaData, mimeType, outputStream, settings, utf8 -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new text document.TextDocument(InputStream inputStream)Instantiates a new text document.TextDocument(String file)Instantiates a new text document.TextDocument(String folder, FileTable inputFileTable)Instantiates a new text document. -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a new object that is a deep copy of the current instance.Gets the automatic styles.getBody()Gets the body.byte[]getBytes()Gets the bytes.Gets the content.Returns all content elements.getFonts()Gets the fonts.getForms()Gets the forms.getHtml()Converts the document to HTML format.Gets the input stream.Gets the office scripts.byte[]Gets the PDF bytes.byte[]getPdfBytes(PdfSaveOptions options)Gets the PDF bytes.Gets the sequence variable declarations.Gets the simple variable declarations.Gets the tracked changes.Gets the user variable declarations.booleanisGlobal()Checks if is global.voidopen(InputStream inputStream)Open.voidOpen.protected voidopenImplementation(InputStream inputStream)voidrenameStyle(Style style, String newName)Rename style.voidsave(OutputStream outputStream)Save.voidSave.voidSave.voidsaveAsHtml(OutputStream stream)Saves the document in HTML format.voidsaveAsHtml(String file)Saves the document in HTML format.voidsaveAsHtml(String file, boolean overwrite)Saves the document in HTML format.voidsaveAsMarkdown(OutputStream stream)Saves the document in Markdown format.voidsaveAsMarkdown(String file)Saves the document in Markdown format.voidsaveAsMarkdown(String file, boolean overwrite)Saves the document in Markdown format.voidsaveAsPdf(OutputStream pdfOutputStream)Saves the document as PDF to an output stream.voidsaveAsPdf(OutputStream pdfOutputStream, PdfSaveOptions options)Saves the document as PDF to an output stream.voidSaves the document as PDF file.voidSaves the document as PDF file.voidsaveAsPdf(String filePath, boolean overwrite, PdfSaveOptions options)Saves the document as PDF file.voidsaveAsPdf(String filePath, PdfSaveOptions options)Saves the document as PDF file.voidsaveAsRtf(OutputStream stream)Saves the document in RTF format.voidSaves the document in RTF format.voidSaves the document in RTF format.voidsetForms(OfficeForms forms)Sets the forms.voidsetGlobal(boolean global)Sets the global.voidsetTrackedChanges(TrackedChanges trackedChanges)Sets the tracked changes.voidsetUseSoftPageBreaks(boolean useSoftPageBreaks)Sets the use soft page breaks.Returns the document content as a Markdown string.toRtf()Converts the document to RTF format.booleanUse soft page breaks.Methods inherited from class com.independentsoft.office.odf.Document
addFile, addFile, addManifestEntry, addMimeTypeFile, addPreservedEmbeddedObjectManifestEntries, find, find, findElements, findElements, findElements, findFirst, findFirst, getAttributedTexts, getCommonStyles, getConfigurations, getCreationDate, getCreator, getCustomFileTable, getDescription, getEditingCycles, getEditingDuration, getFields, getFileInputTable, getGenerator, getHeadings, getImages, getInitialCreator, getInputFileTable, getKeywords, getLanguage, getLastModified, getLists, getManifest, getMetaData, getMimeType, getParagraphs, getPreservedPackageParts, getPrintDate, getPrintedBy, getSections, getStatistic, getSubject, getTables, getTemplate, getText, getTexts, getTitle, getUserDefinedMetadataElements, isTemplate, remove, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replace, replaceContent, setCreationDate, setCreator, setDescription, setEditingCycles, setEditingDuration, setInitialCreator, setKeywords, setLanguage, setLastModified, setMimeType, setPrintDate, setPrintedBy, setStatistic, setSubject, setTemplate, setTemplate, setTitle
-
Constructor Details
-
TextDocument
public TextDocument()Instantiates a new text document. -
TextDocument
Instantiates a new text document.- Parameters:
file- the file- Throws:
IOException- Signals that an I/O exception has occurred.XMLStreamException- the xML stream exception
-
TextDocument
Instantiates a new text document.- Parameters:
inputStream- the input stream- Throws:
IOException- Signals that an I/O exception has occurred.XMLStreamException- the xML stream exception
-
TextDocument
public TextDocument(String folder, FileTable inputFileTable) throws IOException, XMLStreamExceptionInstantiates a new text document.- Parameters:
folder- the folderinputFileTable- the input file table- Throws:
IOException- Signals that an I/O exception has occurred.XMLStreamException- the xML stream exception
-
-
Method Details
-
open
Description copied from class:DocumentOpen.- Specified by:
openin classDocument- Parameters:
filePath- the file- Throws:
IOException- Signals that an I/O exception has occurred.XMLStreamException- the xML stream exception
-
open
Description copied from class:DocumentOpen.- Specified by:
openin classDocument- Parameters:
inputStream- the stream- Throws:
IOException- Signals that an I/O exception has occurred.XMLStreamException- the xML stream exception
-
openImplementation
- Overrides:
openImplementationin classDocument- Throws:
IOExceptionXMLStreamException
-
renameStyle
Rename style.- Parameters:
style- the stylenewName- the new name
-
getContentElements
Returns all content elements.- Specified by:
getContentElementsin classDocument- Returns:
- A collection of content elements.
-
clone
Creates a new object that is a deep copy of the current instance. -
save
Description copied from class:DocumentSave.- Specified by:
savein classDocument- Parameters:
filePath- the file- Throws:
IOException- Signals that an I/O exception has occurred.
-
save
Description copied from class:DocumentSave.- Specified by:
savein classDocument- Parameters:
filePath- the fileoverwrite- the overwrite- Throws:
IOException- Signals that an I/O exception has occurred.
-
save
Description copied from class:DocumentSave.- Specified by:
savein classDocument- Parameters:
outputStream- the stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
getInputStream
Description copied from class:DocumentGets the input stream.- Specified by:
getInputStreamin classDocument- Returns:
- the input stream
- Throws:
IOException- Signals that an I/O exception has occurred.
-
getBytes
Description copied from class:DocumentGets the bytes.- Specified by:
getBytesin classDocument- Returns:
- the bytes
- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsMarkdown
Saves the document in Markdown format.- Parameters:
file- The path of the file to save.- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsMarkdown
Saves the document in Markdown format.- Parameters:
file- The path of the file to save.overwrite- If true, overwrites the existing file.- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsMarkdown
Saves the document in Markdown format.- Parameters:
stream- The stream to save to.- Throws:
IOException- Signals that an I/O exception has occurred.
-
toMarkdown
Returns the document content as a Markdown string.- Returns:
- A Markdown string.
-
saveAsRtf
Saves the document in RTF format.- Parameters:
file- The path of the file to save.- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsRtf
Saves the document in RTF format.- Parameters:
file- The path of the file to save.overwrite- If true, overwrites an existing file.- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsRtf
Saves the document in RTF format.- Parameters:
stream- The stream to save to.- Throws:
IOException- Signals that an I/O exception has occurred.
-
toRtf
Converts the document to RTF format.- Returns:
- The RTF representation of the document.
-
saveAsHtml
Saves the document in HTML format.- Specified by:
saveAsHtmlin classDocument- Parameters:
file- The path of the file to save.- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsHtml
Saves the document in HTML format.- Specified by:
saveAsHtmlin classDocument- Parameters:
file- The path of the file to save.overwrite- If true, overwrites an existing file.- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsHtml
Saves the document in HTML format.- Specified by:
saveAsHtmlin classDocument- Parameters:
stream- The stream to save to.- Throws:
IOException- Signals that an I/O exception has occurred.
-
getHtml
Converts the document to HTML format.- Specified by:
getHtmlin classDocument- Returns:
- The HTML representation of the document.
- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsPdf
Saves the document as PDF file.- Parameters:
filePath- the file path- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsPdf
Saves the document as PDF file.- Parameters:
filePath- the file pathoptions- the PDF export options- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsPdf
Saves the document as PDF file.- Parameters:
filePath- the file pathoverwrite- the overwrite- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsPdf
public void saveAsPdf(String filePath, boolean overwrite, PdfSaveOptions options) throws IOExceptionSaves the document as PDF file.- Parameters:
filePath- the file pathoverwrite- the overwriteoptions- the PDF export options- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsPdf
Saves the document as PDF to an output stream.- Parameters:
pdfOutputStream- the output stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsPdf
Saves the document as PDF to an output stream.- Parameters:
pdfOutputStream- the output streamoptions- the PDF export options- Throws:
IOException- Signals that an I/O exception has occurred.
-
getPdfBytes
Gets the PDF bytes.- Returns:
- the PDF bytes
- Throws:
IOException- Signals that an I/O exception has occurred.
-
getPdfBytes
Gets the PDF bytes.- Parameters:
options- the PDF export options- Returns:
- the PDF bytes
- Throws:
IOException- Signals that an I/O exception has occurred.
-
getBody
Gets the body.- Returns:
- the body
-
getFonts
Gets the fonts.- Returns:
- the fonts
-
getOfficeScripts
Gets the office scripts.- Returns:
- the office scripts
-
getAutomaticStyles
Gets the automatic styles.- Returns:
- the automatic styles
-
getSimpleVariableDeclarations
Gets the simple variable declarations.- Returns:
- the simple variable declarations
-
getSequenceVariableDeclarations
Gets the sequence variable declarations.- Returns:
- the sequence variable declarations
-
getUserVariableDeclarations
Gets the user variable declarations.- Returns:
- the user variable declarations
-
getTrackedChanges
Gets the tracked changes.- Returns:
- the tracked changes
-
setTrackedChanges
Sets the tracked changes.- Parameters:
trackedChanges- the new tracked changes
-
getForms
Gets the forms.- Returns:
- the forms
-
setForms
Sets the forms.- Parameters:
forms- the new forms
-
isGlobal
public boolean isGlobal()Checks if is global.- Returns:
- true, if is global
-
setGlobal
public void setGlobal(boolean global)Sets the global.- Parameters:
global- the new global
-
useSoftPageBreaks
public boolean useSoftPageBreaks()Use soft page breaks.- Returns:
- true, if successful
-
setUseSoftPageBreaks
public void setUseSoftPageBreaks(boolean useSoftPageBreaks)Sets the use soft page breaks.- Parameters:
useSoftPageBreaks- the new use soft page breaks
-
getContent
Gets the content.- Returns:
- the content
-