Class OfficeDocument

java.lang.Object
com.independentsoft.office.OfficeDocument
Direct Known Subclasses:
WordDocument, Workbook

public abstract class OfficeDocument extends Object
The Class OfficeDocument.
  • Field Details

    • utf8

      protected Charset utf8
    • outputStream

      protected ZipOutputStream outputStream
    • contentTypeTable

      protected ContentTypeTable contentTypeTable
    • packageRelationship

      protected Relationship packageRelationship
    • documentRelationship

      protected Relationship documentRelationship
    • coreProperty

      protected CoreProperty coreProperty
    • applicationProperty

      protected ApplicationProperty applicationProperty
    • customProperties

      protected CustomProperties customProperties
    • theme

      protected Theme theme
    • inputFileTable

      protected FileTable inputFileTable
    • customFileTable

      protected FileTable customFileTable
    • macro

      protected byte[] macro
    • mainDocumentFolderName

      protected String mainDocumentFolderName
    • mainDocumentFileName

      protected String mainDocumentFileName
  • Constructor Details

    • OfficeDocument

      public OfficeDocument()
  • Method Details

    • open

      public abstract void open(String file) throws IOException, XMLStreamException
      Open.
      Parameters:
      file - the file
      Throws:
      IOException - Signals that an I/O exception has occurred.
      XMLStreamException - the xML stream exception
    • open

      public abstract void open(InputStream stream) throws IOException, XMLStreamException
      Open.
      Parameters:
      stream - the stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
      XMLStreamException - the xML stream exception
    • save

      public abstract void save(String file) throws IOException
      Save.
      Parameters:
      file - the file
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • save

      public abstract void save(String file, boolean overwrite) throws IOException
      Save.
      Parameters:
      file - the file
      overwrite - the overwrite
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • save

      public abstract void save(OutputStream stream) throws IOException
      Save.
      Parameters:
      stream - the stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getBytes

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

      public abstract InputStream getInputStream() throws IOException
      Gets the input stream.
      Returns:
      the input stream
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • openImplementation

      protected void openImplementation(InputStream stream) throws IOException, XMLStreamException
      Throws:
      IOException
      XMLStreamException
    • addFile

      protected void addFile(String filePath, String file) throws IOException
      Throws:
      IOException
    • addFile

      protected void addFile(String filePath, byte[] buffer) throws IOException
      Throws:
      IOException
    • getTheme

      public Theme getTheme()
      Gets document's themes.
      Returns:
      Theme
    • setTheme

      public void setTheme(Theme theme)
      Sets document's themes.
      Parameters:
      theme - the new theme
    • getContentTypeTable

      public ContentTypeTable getContentTypeTable()
      Gets content types table.
      Returns:
      ContentTypeTable
    • getInputFileTable

      public FileTable getInputFileTable()
      Gets table with all input files. It allows you to get files from the document.
      Returns:
      FileTable
    • getCustomFileTable

      public FileTable getCustomFileTable()
      Gets table with documents custom files. It allows you to add files to the document and save them together with document.
      Returns:
      FileTable
    • getCategory

      public String getCategory()
      Gets the category of the document. Example values for this property might include: Resume, Letter, Technical Presentation, and so on.
      Returns:
      String
    • setCategory

      public void setCategory(String category)
      Sets the category of the document. Example values for this property might include: Resume, Letter, Technical Presentation, and so on.
      Parameters:
      category - the new category
    • getContentStatus

      public String getContentStatus()
      Gets status of the content. Example values for this property might include: "Draft", "Reviewed", "Final", and so on.
      Returns:
      String
    • setContentStatus

      public void setContentStatus(String contentStatus)
      Sets status of the content. Example values for this property might include: "Draft", "Reviewed", "Final", and so on.
      Parameters:
      contentStatus - the new content status
    • getContentType

      public String getContentType()
      Gets type of content represented, generally defined by a specific use and intended audience. This property is distinct from MIME content types as defined in RFC 2616.
      Returns:
      String
    • setContentType

      public void setContentType(String contentType)
      Sets type of content represented, generally defined by a specific use and intended audience. This property is distinct from MIME content types as defined in RFC 2616.
      Parameters:
      contentType - the new content type
    • getCreated

      public Date getCreated()
      Gets date and time of creation of the document.
      Returns:
      Date
    • setCreated

      public void setCreated(Date created)
      Sets date and time of creation of the document.
      Parameters:
      created - the new created
    • getCreator

      public String getCreator()
      Gets entity primarily responsible for making the content of the document.
      Returns:
      String
    • setCreator

      public void setCreator(String creator)
      Sets entity primarily responsible for making the content of the document.
      Parameters:
      creator - the new creator
    • getDescription

      public String getDescription()
      Gets explanation of the content of the document.
      Returns:
      String
    • setDescription

      public void setDescription(String description)
      Sets explanation of the content of the document.
      Parameters:
      description - the new description
    • getIdentifier

      public String getIdentifier()
      Gets unambiguous reference to the document within a given context.
      Returns:
      String
    • setIdentifier

      public void setIdentifier(String identifier)
      Sets unambiguous reference to the document within a given context.
      Parameters:
      identifier - the new identifier
    • getKeywords

      public String getKeywords()
      Gets delimited set of keywords to support searching and indexing. This is typically a list of terms that are not available elsewhere in the properties.
      Returns:
      String
    • setKeywords

      public void setKeywords(String keywords)
      Sets delimited set of keywords to support searching and indexing. This is typically a list of terms that are not available elsewhere in the properties.
      Parameters:
      keywords - the new keywords
    • getLanguage

      public String getLanguage()
      Gets the language of the intellectual content of the document. RFC 3066 provides guidance on encoding to represent languages.
      Returns:
      String
    • setLanguage

      public void setLanguage(String language)
      Sets the language of the intellectual content of the document. RFC 3066 provides guidance on encoding to represent languages.
      Parameters:
      language - the new language
    • getLastModifiedBy

      public String getLastModifiedBy()
      Gets user who performed the last modification. Example values for this property might include: A name, email address, employee ID, and so on.
      Returns:
      String
    • setLastModifiedBy

      public void setLastModifiedBy(String lastModifiedBy)
      Sets user who performed the last modification. Example values for this property might include: A name, email address, employee ID, and so on.
      Parameters:
      lastModifiedBy - the new last modified by
    • getLastPrinted

      public Date getLastPrinted()
      Gets date and time of the last printing.
      Returns:
      Date
    • setLastPrinted

      public void setLastPrinted(Date lastPrinted)
      Sets date and time of the last printing.
      Parameters:
      lastPrinted - the new last printed
    • getModified

      public Date getModified()
      Gets date and time on which the document was changed.
      Returns:
      Date
    • setModified

      public void setModified(Date modified)
      Sets date and time on which the document was changed.
      Parameters:
      modified - the new modified
    • getRevision

      public String getRevision()
      Gets the revision number.
      Returns:
      String
    • setRevision

      public void setRevision(String revision)
      Sets the revision number.
      Parameters:
      revision - the new revision
    • getSubject

      public String getSubject()
      Gets the topic of the content of the document.
      Returns:
      String
    • setSubject

      public void setSubject(String subject)
      Sets the topic of the content of the document.
      Parameters:
      subject - the new subject
    • getTitle

      public String getTitle()
      Gets the name given to the document.
      Returns:
      String
    • setTitle

      public void setTitle(String title)
      Sets the name given to the document.
      Parameters:
      title - the new title
    • getVersion

      public String getVersion()
      Gets the version number.
      Returns:
      String
    • setVersion

      public void setVersion(String version)
      Sets the version number.
      Parameters:
      version - the new version
    • getApplicationName

      public String getApplicationName()
      Gets the name of the application that created the document.
      Returns:
      String
    • setApplicationName

      public void setApplicationName(String applicationName)
      Sets the name of the application that created the document.
      Parameters:
      applicationName - the new application name
    • getApplicationVersion

      public String getApplicationVersion()
      Gets the version of the application that created the document.
      Returns:
      String
    • setApplicationVersion

      public void setApplicationVersion(String applicationVersion)
      Sets the version of the application that created the document.
      Parameters:
      applicationVersion - the new application version
    • getCharacterCount

      public int getCharacterCount()
      Gets the total number of characters in the document.
      Returns:
      int
    • setCharacterCount

      public void setCharacterCount(int characterCount)
      Sets the total number of characters in the document.
      Parameters:
      characterCount - the new character count
    • getLastCharacterCount

      public int getLastCharacterCount()
      Gets the last count of the number of characters (including spaces) in the document.
      Returns:
      int
    • setLastCharacterCount

      public void setLastCharacterCount(int lastCharacterCount)
      Sets the last count of the number of characters (including spaces) in the document.
      Parameters:
      lastCharacterCount - the new last character count
    • getCompany

      public String getCompany()
      Gets the name of a company associated with the document.
      Returns:
      String
    • setCompany

      public void setCompany(String company)
      Sets the name of a company associated with the document.
      Parameters:
      company - the new company
    • getDigitalSignature

      public String getDigitalSignature()
      Gets the signature of a digitally signed document.
      Returns:
      String
    • setDigitalSignature

      public void setDigitalSignature(String digitalSignature)
      Sets the signature of a digitally signed document.
      Parameters:
      digitalSignature - the new digital signature
    • getDocumentSecurity

      public int getDocumentSecurity()
      Gets the security level of the document as a numeric value.
      Returns:
      int
    • setDocumentSecurity

      public void setDocumentSecurity(int documentSecurity)
      Sets the security level of the document as a numeric value.
      Parameters:
      documentSecurity - the new document security
    • getHeadingPairs

      public String getHeadingPairs()
      Gets heading pairs. Heading pairs indicates the grouping of document parts and the number of parts in each group. These parts are not document parts but conceptual representations of document sections.
      Returns:
      String
    • setHeadingPairs

      public void setHeadingPairs(String headingPairs)
      Sets heading pairs. Heading pairs indicates the grouping of document parts and the number of parts in each group. These parts are not document parts but conceptual representations of document sections.
      Parameters:
      headingPairs - the new heading pairs
    • getHiddenSlideCount

      public String getHiddenSlideCount()
      Gets the number of hidden slides in a presentation document.
      Returns:
      String
    • setHiddenSlideCount

      public void setHiddenSlideCount(String hiddenSlideCount)
      Sets the number of hidden slides in a presentation document.
      Parameters:
      hiddenSlideCount - the new hidden slide count
    • getHyperlinkList

      public String getHyperlinkList()
      Gets the set of hyperlinks that were in the document when last saved.
      Returns:
      String
    • setHyperlinkList

      public void setHyperlinkList(String hyperlinkList)
      Sets the set of hyperlinks that were in the document when last saved.
      Parameters:
      hyperlinkList - the new hyperlink list
    • getRelativeHyperlinkBase

      public String getRelativeHyperlinkBase()
      Gets the base string used for evaluating relative hyperlinks in this document.
      Returns:
      String
    • setRelativeHyperlinkBase

      public void setRelativeHyperlinkBase(String relativeHyperlinkBase)
      Sets the base string used for evaluating relative hyperlinks in this document.
      Parameters:
      relativeHyperlinkBase - the new relative hyperlink base
    • hasHyperlinksChanged

      public boolean hasHyperlinksChanged()
      This element specifies that one or more hyperlinks in this part were updated exclusively in this part by a producer. The next producer to open this document shall update the hyperlink relationships with the new hyperlinks specified in this part.
      Returns:
      boolean
    • setHyperlinksChanged

      public void setHyperlinksChanged(boolean hyperlinksChanged)
      This element specifies that one or more hyperlinks in this part were updated exclusively in this part by a producer. The next producer to open this document shall update the hyperlink relationships with the new hyperlinks specified in this part.
      Parameters:
      hyperlinksChanged - the new hyperlinks changed
    • getLineCount

      public int getLineCount()
      Gets the total number of lines in the document.
      Returns:
      int
    • setLineCount

      public void setLineCount(int lineCount)
      Sets the total number of lines in the document.
      Parameters:
      lineCount - the new line count
    • hasLinksUpToDate

      public boolean hasLinksUpToDate()
      Indicates whether hyperlinks in the document are up-to-date. Set this element to TRUE to indicate that hyperlinks are updated. Set this element to FALSE to indicate that hyperlinks are outdated.
      Returns:
      boolean
    • setLinksUpToDate

      public void setLinksUpToDate(boolean linksUpToDate)
      Indicates whether hyperlinks in the document are up-to-date. Set this element to TRUE to indicate that hyperlinks are updated. Set this element to FALSE to indicate that hyperlinks are outdated.
      Parameters:
      linksUpToDate - the new links up to date
    • getManager

      public String getManager()
      Gets the name of a supervisor associated with the document.
      Returns:
      String
    • setManager

      public void setManager(String manager)
      Sets the name of a supervisor associated with the document.
      Parameters:
      manager - the new manager
    • getMultimediaClipCount

      public int getMultimediaClipCount()
      Gets the total number of sound or video clips that are present in the document.
      Returns:
      int
    • setMultimediaClipCount

      public void setMultimediaClipCount(int multimediaClipCount)
      Sets the total number of sound or video clips that are present in the document.
      Parameters:
      multimediaClipCount - the new multimedia clip count
    • getNoteCount

      public int getNoteCount()
      Gets the number of slides in a presentation containing notes.
      Returns:
      int
    • setNoteCount

      public void setNoteCount(int noteCount)
      Sets the number of slides in a presentation containing notes.
      Parameters:
      noteCount - the new note count
    • getPageCount

      public int getPageCount()
      Gets the total number of pages of the document.
      Returns:
      int
    • setPageCount

      public void setPageCount(int pageCount)
      Sets the total number of pages of the document.
      Parameters:
      pageCount - the new page count
    • getParagraphCount

      public int getParagraphCount()
      Gets the total number of paragraphs found in the document.
      Returns:
      int
    • setParagraphCount

      public void setParagraphCount(int paragraphCount)
      Sets the total number of paragraphs found in the document.
      Parameters:
      paragraphCount - the new paragraph count
    • getPresentationFormat

      public String getPresentationFormat()
      Gets the intended format for a presentation document.
      Returns:
      String
    • setPresentationFormat

      public void setPresentationFormat(String presentationFormat)
      Sets the intended format for a presentation document.
      Parameters:
      presentationFormat - the new presentation format
    • hasEnableScaling

      public boolean hasEnableScaling()
      Indicates the display mode of the document thumbnail. Set this element to TRUE to enable scaling of the document thumbnail to the display. Set this element to FALSE to enable cropping of the document thumbnail to show only sections that will fit the display.
      Returns:
      boolean
    • setEnableScaling

      public void setEnableScaling(boolean enableScaling)
      Indicates the display mode of the document thumbnail. Set this element to TRUE to enable scaling of the document thumbnail to the display. Set this element to FALSE to enable cropping of the document thumbnail to show only sections that will fit the display.
      Parameters:
      enableScaling - the new enable scaling
    • isSharedDocument

      public boolean isSharedDocument()
      Indicates if this document is currently shared between multiple producers. If this element is set to TRUE, producers should take care when updating the document.
      Returns:
      boolean
    • setSharedDocument

      public void setSharedDocument(boolean sharedDocument)
      Indicates if this document is currently shared between multiple producers. If this element is set to TRUE, producers should take care when updating the document.
      Parameters:
      sharedDocument - the new shared document
    • getTemplateName

      public String getTemplateName()
      Gets name of an external document template containing format and style information used to create the document.
      Returns:
      String
    • setTemplateName

      public void setTemplateName(String templateName)
      Sets name of an external document template containing format and style information used to create the document.
      Parameters:
      templateName - the new template name
    • getPartTitles

      public String getPartTitles()
      Gets the title of each document.
      Returns:
      String
    • setPartTitles

      public void setPartTitles(String partTitles)
      Sets the title of each document.
      Parameters:
      partTitles - the new part titles
    • getTotalTime

      public long getTotalTime()
      Gets total time the document has been edited. The default time unit is minutes.
      Returns:
      long
    • setTotalTime

      public void setTotalTime(long totalTime)
      Sets total time the document has been edited. The default time unit is minutes.
      Parameters:
      totalTime - the new total time
    • getWordCount

      public int getWordCount()
      Gets the total number of words of the document.
      Returns:
      int
    • setWordCount

      public void setWordCount(int totalTime)
      Sets the total number of words of the document.
      Parameters:
      totalTime - the new word count
    • getCustomProperties

      public List<CustomProperty> getCustomProperties()
      Gets the custom properties.
      Returns:
      the custom properties
    • getMacro

      public byte[] getMacro()
      Gets the macro.
      Returns:
      the macro
    • setMacro

      public void setMacro(byte[] macro)
      Sets the macro.
      Parameters:
      macro - the new macro
    • getMainDocumentFolderName

      public String getMainDocumentFolderName()
      Gets the main document folder name.
      Returns:
      the main document folder name