Class TextDocument

java.lang.Object
com.independentsoft.office.odf.Document
com.independentsoft.office.odf.TextDocument

public class TextDocument extends Document
The Class TextDocument.
  • Constructor Details

  • Method Details

    • open

      public void open(String filePath) throws IOException, XMLStreamException
      Description copied from class: Document
      Open.
      Specified by:
      open in class Document
      Parameters:
      filePath - the file
      Throws:
      IOException - Signals that an I/O exception has occurred.
      XMLStreamException - the xML stream exception
    • open

      public void open(InputStream inputStream) throws IOException, XMLStreamException
      Description copied from class: Document
      Open.
      Specified by:
      open in class Document
      Parameters:
      inputStream - the stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
      XMLStreamException - the xML stream exception
    • openImplementation

      protected void openImplementation(InputStream inputStream) throws IOException, XMLStreamException
      Overrides:
      openImplementation in class Document
      Throws:
      IOException
      XMLStreamException
    • renameStyle

      public void renameStyle(Style style, String newName)
      Rename style.
      Parameters:
      style - the style
      newName - the new name
    • getContentElements

      public List<IContentElement> getContentElements()
      Returns all content elements.
      Specified by:
      getContentElements in class Document
      Returns:
      A collection of content elements.
    • clone

      public TextDocument clone()
      Creates a new object that is a deep copy of the current instance.
      Overrides:
      clone in class Object
      Returns:
      A new object that is a copy of this instance.
    • save

      public void save(String filePath) throws IOException
      Description copied from class: Document
      Save.
      Specified by:
      save in class Document
      Parameters:
      filePath - the file
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • save

      public void save(String filePath, boolean overwrite) throws IOException
      Description copied from class: Document
      Save.
      Specified by:
      save in class Document
      Parameters:
      filePath - the file
      overwrite - the overwrite
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • save

      public void save(OutputStream outputStream) throws IOException
      Description copied from class: Document
      Save.
      Specified by:
      save in class Document
      Parameters:
      outputStream - the stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from class: Document
      Gets the input stream.
      Specified by:
      getInputStream in class Document
      Returns:
      the input stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getBytes

      public byte[] getBytes() throws IOException
      Description copied from class: Document
      Gets the bytes.
      Specified by:
      getBytes in class Document
      Returns:
      the bytes
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • toText

      public String toText()
      To text.
      Returns:
      the string
    • saveAsRtf

      public void saveAsRtf(String filePath) throws IOException
      Saves the document as RTF file.
      Parameters:
      filePath - the file path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsRtf

      public void saveAsRtf(String filePath, boolean overwrite) throws IOException
      Saves the document as RTF file.
      Parameters:
      filePath - the file path
      overwrite - the overwrite
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsRtf

      public void saveAsRtf(OutputStream rtfOutputStream) throws IOException
      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

      public byte[] getRtfBytes() throws IOException
      Gets the RTF bytes.
      Returns:
      the RTF bytes
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsMarkdown

      public void saveAsMarkdown(String filePath) throws IOException
      Saves the document as Markdown file.
      Parameters:
      filePath - the file path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsMarkdown

      public void saveAsMarkdown(String filePath, boolean overwrite) throws IOException
      Saves the document as Markdown file.
      Parameters:
      filePath - the file path
      overwrite - the overwrite
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsMarkdown

      public void saveAsMarkdown(OutputStream mdOutputStream) throws IOException
      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

      public byte[] getMarkdownBytes() throws IOException
      Gets the Markdown bytes.
      Returns:
      the Markdown bytes
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsHtml

      public void saveAsHtml(String filePath) throws IOException
      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

      public void saveAsHtml(String filePath, boolean overwrite) throws IOException
      Save the document as HTML to the specified file path.
      Parameters:
      filePath - the file path
      overwrite - whether to overwrite existing file
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsHtml

      public void saveAsHtml(OutputStream htmlOutputStream) throws IOException
      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

      public byte[] getHtmlBytes() throws IOException
      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

      public void saveAsPdf(String filePath) throws IOException
      Saves the document as PDF file.
      Parameters:
      filePath - the file path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsPdf

      public void saveAsPdf(String filePath, PdfSaveOptions options) throws IOException
      Saves the document as PDF file.
      Parameters:
      filePath - the file path
      options - the PDF export options
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsPdf

      public void saveAsPdf(String filePath, boolean overwrite) throws IOException
      Saves the document as PDF file.
      Parameters:
      filePath - the file path
      overwrite - the overwrite
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsPdf

      public void saveAsPdf(String filePath, boolean overwrite, PdfSaveOptions options) throws IOException
      Saves the document as PDF file.
      Parameters:
      filePath - the file path
      overwrite - the overwrite
      options - the PDF export options
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • saveAsPdf

      public void saveAsPdf(OutputStream pdfOutputStream) throws IOException
      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

      public void saveAsPdf(OutputStream pdfOutputStream, PdfSaveOptions options) throws IOException
      Saves the document as PDF to an output stream.
      Parameters:
      pdfOutputStream - the output stream
      options - the PDF export options
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getPdfBytes

      public byte[] getPdfBytes() throws IOException
      Gets the PDF bytes.
      Returns:
      the PDF bytes
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getPdfBytes

      public byte[] getPdfBytes(PdfSaveOptions options) throws IOException
      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

      public TextDocumentBody getBody()
      Gets the body.
      Returns:
      the body
    • getFonts

      public List<Font> getFonts()
      Gets the fonts.
      Returns:
      the fonts
    • getOfficeScripts

      public OfficeScripts getOfficeScripts()
      Gets the office scripts.
      Returns:
      the office scripts
    • getAutomaticStyles

      public AutomaticStyles getAutomaticStyles()
      Gets the automatic styles.
      Returns:
      the automatic styles
    • getSimpleVariableDeclarations

      public List<SimpleVariableDeclaration> getSimpleVariableDeclarations()
      Gets the simple variable declarations.
      Returns:
      the simple variable declarations
    • getSequenceVariableDeclarations

      public List<SequenceVariableDeclaration> getSequenceVariableDeclarations()
      Gets the sequence variable declarations.
      Returns:
      the sequence variable declarations
    • getUserVariableDeclarations

      public List<UserVariableDeclaration> getUserVariableDeclarations()
      Gets the user variable declarations.
      Returns:
      the user variable declarations
    • getTrackedChanges

      public TrackedChanges getTrackedChanges()
      Gets the tracked changes.
      Returns:
      the tracked changes
    • setTrackedChanges

      public void setTrackedChanges(TrackedChanges trackedChanges)
      Sets the tracked changes.
      Parameters:
      trackedChanges - the new tracked changes
    • getForms

      public OfficeForms getForms()
      Gets the forms.
      Returns:
      the forms
    • setForms

      public void setForms(OfficeForms forms)
      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

      public TextDocumentContent getContent()
      Gets the content.
      Returns:
      the content