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.byte[]Get HTML representation of the document as a byte array.Gets the input stream.byte[]Gets the Markdown bytes.Gets the office scripts.byte[]Gets the PDF bytes.byte[]getPdfBytes(PdfSaveOptions options)Gets the PDF bytes.byte[]Gets the RTF 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 htmlOutputStream)Save the document as HTML to the specified output stream.voidsaveAsHtml(String filePath)Save the document as HTML to the specified file path.voidsaveAsHtml(String filePath, boolean overwrite)Save the document as HTML to the specified file path.voidsaveAsMarkdown(OutputStream mdOutputStream)Saves the document as Markdown to an output stream.voidsaveAsMarkdown(String filePath)Saves the document as Markdown file.voidsaveAsMarkdown(String filePath, boolean overwrite)Saves the document as Markdown file.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 rtfOutputStream)Saves the document as RTF to an output stream.voidSaves the document as RTF file.voidSaves the document as RTF file.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.toText()To text.booleanUse soft page breaks.Methods inherited from class com.independentsoft.office.odf.Document
addFile, addFile, addManifestEntry, addMimeTypeFile, 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, getTexts, getTitle, getUserDefinedMetadataElements, isTemplate, replace, replace, 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.
-
toText
To text.- Returns:
- the string
-
saveAsRtf
Saves the document as RTF file.- Parameters:
filePath- the file path- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsRtf
Saves the document as RTF file.- Parameters:
filePath- the file pathoverwrite- the overwrite- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsRtf
Saves the document as RTF to an output stream.- Parameters:
rtfOutputStream- the output stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
getRtfBytes
Gets the RTF bytes.- Returns:
- the RTF bytes
- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsMarkdown
Saves the document as Markdown file.- Parameters:
filePath- the file path- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsMarkdown
Saves the document as Markdown file.- Parameters:
filePath- the file pathoverwrite- the overwrite- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsMarkdown
Saves the document as Markdown to an output stream.- Parameters:
mdOutputStream- the output stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
getMarkdownBytes
Gets the Markdown bytes.- Returns:
- the Markdown bytes
- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsHtml
Save the document as HTML to the specified file path.- Parameters:
filePath- the file path- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsHtml
Save the document as HTML to the specified file path.- Parameters:
filePath- the file pathoverwrite- whether to overwrite existing file- Throws:
IOException- Signals that an I/O exception has occurred.
-
saveAsHtml
Save the document as HTML to the specified output stream.- Parameters:
outputStream- the output stream- Throws:
IOException- Signals that an I/O exception has occurred.
-
getHtmlBytes
Get HTML representation of the document as a byte array.- Returns:
- the HTML bytes
- 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
-