Package com.independentsoft.office.odf

# Class Spreadsheet

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

public class Spreadsheet extends Document
The Class Spreadsheet.

- ## Field Summary

  ### Fields inherited from class com.independentsoft.office.odf.Document

  `commonStyles, customFileTable, inputFileTable, isTemplate, manifest, metaData, mimeType, outputStream, settings, utf8`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Spreadsheet()`
  Instantiates a new spreadsheet, seeded with the one table a usable .ods needs.
  `Spreadsheet​(InputStream inputStream)`
  Instantiates a new spreadsheet.
  `Spreadsheet​(String file)`
  Instantiates a new spreadsheet.
  `Spreadsheet​(String folder, FileTable inputFileTable)`
  Instantiates a new spreadsheet.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Spreadsheet`
  `clone()`
  Creates a new object that is a deep copy of the current instance.
  `AutomaticStyles`
  `getAutomaticStyles()`
  Gets the automatic styles.
  `byte[]`
  `getBytes()`
  Gets the bytes.
  `CalculationSettings`
  `getCalculationSettings()`
  Gets the calculation settings.
  `SpreadsheetContent`
  `getContent()`
  Gets the content.
  `List<IContentElement>`
  `getContentElements()`
  Returns all content elements.
  `List<ContentValidation>`
  `getContentValidations()`
  Gets the content validations.
  `String`
  `getCsv()`
  Returns the content of all tables as comma separated values.
  `List<DatabaseRange>`
  `getDatabaseRanges()`
  Gets the database ranges.
  `List<Font>`
  `getFonts()`
  Gets the fonts.
  `String`
  `getHtml()`
  Converts the document to HTML format.
  `InputStream`
  `getInputStream()`
  Gets the input stream.
  `double`
  `getIterationMaximumDifference()`
  Gets the iteration maximum difference.
  `int`
  `getIterationStep()`
  Gets the iteration step.
  `List<LabelRange>`
  `getLabelRanges()`
  Gets the label ranges.
  `List<NamedElement>`
  `getNamedElements()`
  Gets the named elements.
  `OfficeScripts`
  `getOfficeScripts()`
  Gets the office scripts.
  `String`
  `getProtectionKey()`
  Gets the protection key.
  `String`
  `getStartDate()`
  Gets the start date.
  `CellValueType`
  `getStartDateType()`
  Gets the start date type.
  `int`
  `getStartYear()`
  Gets the start year.
  `List<Table>`
  `getTables()`
  Gets the tables.
  `boolean`
  `isApplySearchCriteriaToWholeCell()`
  Checks if is apply search criteria to whole cell.
  `boolean`
  `isAutomaticallyFindLabels()`
  Checks if is automatically find labels.
  `boolean`
  `isCaseSensitive()`
  Checks if is case sensitive.
  `boolean`
  `isIterationStatus()`
  Checks if is iteration status.
  `boolean`
  `isProtected()`
  Checks if is protected.
  `void`
  `open​(InputStream inputStream)`
  Open.
  `void`
  `open​(String filePath)`
  Open.
  `protected void`
  `openImplementation​(InputStream inputStream)`
  `void`
  `renameStyle​(Style style, String newName)`
  Rename style.
  `void`
  `save​(OutputStream outputStream)`
  Save.
  `void`
  `save​(String filePath)`
  Save.
  `void`
  `save​(String filePath, boolean overwrite)`
  Save.
  `void`
  `saveAsHtml​(OutputStream stream)`
  Saves the document in HTML format.
  `void`
  `saveAsHtml​(String file)`
  Saves the document in HTML format.
  `void`
  `saveAsHtml​(String file, boolean overwrite)`
  Saves the document in HTML format.
  `void`
  `setApplySearchCriteriaToWholeCell​(boolean applySearchCriteriaToWholeCell)`
  Sets the apply search criteria to whole cell.
  `void`
  `setAutomaticallyFindLabels​(boolean automaticallyFindLabels)`
  Sets the automatically find labels.
  `void`
  `setCaseSensitive​(boolean isCaseSensitive)`
  Sets the case sensitive.
  `void`
  `setIterationMaximumDifference​(double iterationMaximumDifference)`
  Sets the iteration maximum difference.
  `void`
  `setIterationStatus​(boolean iterationStatus)`
  Sets the iteration status.
  `void`
  `setIterationStep​(int iterationStep)`
  Sets the iteration step.
  `void`
  `setProtected​(boolean isProtected)`
  Sets the protected.
  `void`
  `setProtectionKey​(String protectionKey)`
  Sets the protection key.
  `void`
  `setStartDate​(String startDate)`
  Sets the start date.
  `void`
  `setStartDateType​(CellValueType startDateType)`
  Sets the start date type.
  `void`
  `setStartYear​(int startYear)`
  Sets the start year.
  `void`
  `setUsePrecisionAsShown​(boolean usePrecisionAsShown)`
  Sets the use precision as shown.
  `void`
  `setUseRegularExpressions​(boolean useRegularExpressions)`
  Sets the use regular expressions.
  `boolean`
  `usePrecisionAsShown()`
  Use precision as shown.
  `boolean`
  `useRegularExpressions()`
  Use regular expressions.
  `List<ValidationError>`
  `validate()`
  Checks the spreadsheet for the things that make an .ods unusable or non-conforming, and returns what it finds.

  ### 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, 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`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Spreadsheet

    public Spreadsheet()
    Instantiates a new spreadsheet, seeded with the one table a usable .ods needs. The schema tolerates a spreadsheet with no tables, but nothing can be put in it and no application shows anything, so a new document starts the way Calc starts one.

  - ### Spreadsheet

    public Spreadsheet​(String file) throws IOException, XMLStreamException
    Instantiates a new spreadsheet.
    Parameters:
      `file` - the file
    Throws:
      `IOException` - Signals that an I/O exception has occurred.
      `XMLStreamException` - the xML stream exception

  - ### Spreadsheet

    public Spreadsheet​(InputStream inputStream) throws IOException, XMLStreamException
    Instantiates a new spreadsheet.
    Parameters:
      `inputStream` - the input stream
    Throws:
      `IOException` - Signals that an I/O exception has occurred.
      `XMLStreamException` - the xML stream exception

  - ### Spreadsheet

    public Spreadsheet​(String folder, FileTable inputFileTable) throws IOException, XMLStreamException
    Instantiates a new spreadsheet.
    Parameters:
      `folder` - the folder
      `inputFileTable` - the input file table
    Throws:
      `IOException` - Signals that an I/O exception has occurred.
      `XMLStreamException` - the xML stream exception

- ## Method Details

  - ### validate

    public List<ValidationError> validate()
    Checks the spreadsheet for the things that make an .ods unusable or non-conforming, and returns what it finds. An empty list means nothing known is wrong. This is NOT a schema validator - OpenDocument is defined in RELAX NG and validating against it needs the schema itself; see tools/odf-validate. This knows the invariants the object model can express, and nothing beyond them.
    Returns:
      the problems found, in document order. Never null.

  - ### 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 Spreadsheet 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.

  - ### saveAsHtml

    public void saveAsHtml​(String file) throws IOException
    Saves the document in HTML format.
    Specified by:
      `saveAsHtml` in class `Document`
    Parameters:
      `file` - The path of the file to save.
    Throws:
      `IOException` - Signals that an I/O exception has occurred.

  - ### saveAsHtml

    public void saveAsHtml​(String file, boolean overwrite) throws IOException
    Saves the document in HTML format.
    Specified by:
      `saveAsHtml` in class `Document`
    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

    public void saveAsHtml​(OutputStream stream) throws IOException
    Saves the document in HTML format.
    Specified by:
      `saveAsHtml` in class `Document`
    Parameters:
      `stream` - The stream to save to.
    Throws:
      `IOException` - Signals that an I/O exception has occurred.

  - ### getHtml

    public String getHtml() throws IOException
    Converts the document to HTML format.
    Specified by:
      `getHtml` in class `Document`
    Returns:
      The HTML representation of the document.
    Throws:
      `IOException` - Signals that an I/O exception has occurred.

  - ### getTables

    public List<Table> getTables()
    Description copied from class: `Document`
    Gets the tables.
    Overrides:
      `getTables` in class `Document`
    Returns:
      the tables

  - ### getCsv

    public String getCsv()
    Returns the content of all tables as comma separated values. Each table is preceded by an empty line and its name, the cells of a row are separated by a comma and the rows are separated by a line break. A field which contains a comma, a quotation mark or a line break is enclosed in quotation marks and an embedded quotation mark is doubled, as specified by RFC 4180. The empty cells and rows a table is padded with are not written.
    Returns:
      the comma separated values of all tables

  - ### getNamedElements

    public List<NamedElement> getNamedElements()
    Gets the named elements.
    Returns:
      the named elements

  - ### getDatabaseRanges

    public List<DatabaseRange> getDatabaseRanges()
    Gets the database ranges.
    Returns:
      the database ranges

  - ### isProtected

    public boolean isProtected()
    Checks if is protected.
    Returns:
      true, if is protected

  - ### setProtected

    public void setProtected​(boolean isProtected)
    Sets the protected.
    Parameters:
      `isProtected` - the new protected

  - ### getProtectionKey

    public String getProtectionKey()
    Gets the protection key.
    Returns:
      the protection key

  - ### setProtectionKey

    public void setProtectionKey​(String protectionKey)
    Sets the protection key.
    Parameters:
      `protectionKey` - the new protection key

  - ### isCaseSensitive

    public boolean isCaseSensitive()
    Checks if is case sensitive.
    Returns:
      true, if is case sensitive

  - ### setCaseSensitive

    public void setCaseSensitive​(boolean isCaseSensitive)
    Sets the case sensitive.
    Parameters:
      `isCaseSensitive` - the new case sensitive

  - ### usePrecisionAsShown

    public boolean usePrecisionAsShown()
    Use precision as shown.
    Returns:
      true, if successful

  - ### setUsePrecisionAsShown

    public void setUsePrecisionAsShown​(boolean usePrecisionAsShown)
    Sets the use precision as shown.
    Parameters:
      `usePrecisionAsShown` - the new use precision as shown

  - ### isApplySearchCriteriaToWholeCell

    public boolean isApplySearchCriteriaToWholeCell()
    Checks if is apply search criteria to whole cell.
    Returns:
      true, if is apply search criteria to whole cell

  - ### setApplySearchCriteriaToWholeCell

    public void setApplySearchCriteriaToWholeCell​(boolean applySearchCriteriaToWholeCell)
    Sets the apply search criteria to whole cell.
    Parameters:
      `applySearchCriteriaToWholeCell` - the new apply search criteria to whole cell

  - ### isAutomaticallyFindLabels

    public boolean isAutomaticallyFindLabels()
    Checks if is automatically find labels.
    Returns:
      true, if is automatically find labels

  - ### setAutomaticallyFindLabels

    public void setAutomaticallyFindLabels​(boolean automaticallyFindLabels)
    Sets the automatically find labels.
    Parameters:
      `automaticallyFindLabels` - the new automatically find labels

  - ### useRegularExpressions

    public boolean useRegularExpressions()
    Use regular expressions.
    Returns:
      true, if successful

  - ### setUseRegularExpressions

    public void setUseRegularExpressions​(boolean useRegularExpressions)
    Sets the use regular expressions.
    Parameters:
      `useRegularExpressions` - the new use regular expressions

  - ### getStartYear

    public int getStartYear()
    Gets the start year.
    Returns:
      the start year

  - ### setStartYear

    public void setStartYear​(int startYear)
    Sets the start year.
    Parameters:
      `startYear` - the new start year

  - ### getStartDateType

    public CellValueType getStartDateType()
    Gets the start date type.
    Returns:
      the start date type

  - ### setStartDateType

    public void setStartDateType​(CellValueType startDateType)
    Sets the start date type.
    Parameters:
      `startDateType` - the new start date type

  - ### getStartDate

    public String getStartDate()
    Gets the start date.
    Returns:
      the start date

  - ### setStartDate

    public void setStartDate​(String startDate)
    Sets the start date.
    Parameters:
      `startDate` - the new start date

  - ### isIterationStatus

    public boolean isIterationStatus()
    Checks if is iteration status.
    Returns:
      true, if is iteration status

  - ### setIterationStatus

    public void setIterationStatus​(boolean iterationStatus)
    Sets the iteration status.
    Parameters:
      `iterationStatus` - the new iteration status

  - ### getIterationStep

    public int getIterationStep()
    Gets the iteration step.
    Returns:
      the iteration step

  - ### setIterationStep

    public void setIterationStep​(int iterationStep)
    Sets the iteration step.
    Parameters:
      `iterationStep` - the new iteration step

  - ### getIterationMaximumDifference

    public double getIterationMaximumDifference()
    Gets the iteration maximum difference.
    Returns:
      the iteration maximum difference

  - ### setIterationMaximumDifference

    public void setIterationMaximumDifference​(double iterationMaximumDifference)
    Sets the iteration maximum difference.
    Parameters:
      `iterationMaximumDifference` - the new iteration maximum difference

  - ### 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

  - ### getCalculationSettings

    public CalculationSettings getCalculationSettings()
    Gets the calculation settings.
    Returns:
      the calculation settings

  - ### getLabelRanges

    public List<LabelRange> getLabelRanges()
    Gets the label ranges.
    Returns:
      the label ranges

  - ### getContentValidations

    public List<ContentValidation> getContentValidations()
    Gets the content validations.
    Returns:
      the content validations

  - ### getContent

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