Class AccessSpreadSheetWriter

    • Field Detail

      • m_FileFormat

        protected com.healthmarketscience.jackcess.Database.FileFormat m_FileFormat
        the file format to use.
      • m_TableName

        protected String m_TableName
        the table name to use.
      • m_Appending

        protected boolean m_Appending
        whether to append spreadsheets.
      • m_Header

        protected SpreadSheet m_Header
        the header of the first spreadsheet written to file, if appending is active.
      • m_KeepExisting

        protected boolean m_KeepExisting
        whether to keep existing files the first time the writer is called.
      • m_FileExists

        protected boolean m_FileExists
        whether the file already exists.
      • m_Database

        protected transient com.healthmarketscience.jackcess.Database m_Database
        the database object to use.
      • m_Table

        protected transient com.healthmarketscience.jackcess.Table m_Table
        the table object to use.
      • m_ColumnTypes

        protected HashMap<Integer,​com.healthmarketscience.jackcess.DataType> m_ColumnTypes
        the column types.
    • Constructor Detail

      • AccessSpreadSheetWriter

        public AccessSpreadSheetWriter()
    • Method Detail

      • setFileFormat

        public void setFileFormat​(com.healthmarketscience.jackcess.Database.FileFormat value)
        Sets the file format to use when creating a database.
        Parameters:
        value - the file format
      • getFileFormat

        public com.healthmarketscience.jackcess.Database.FileFormat getFileFormat()
        Returns the file format in use when creating a database.
        Returns:
        the file format
      • fileFormatTipText

        public String fileFormatTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • setTableName

        public void setTableName​(String value)
        Sets the table name to use. If empty the spreadsheet's name is used.
        Parameters:
        value - the table name
      • getTableName

        public String getTableName()
        Returns the table name to use. If empty the spreadsheet's name is used.
        Returns:
        the table name
      • tableNameTipText

        public String tableNameTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • canAppend

        public boolean canAppend​(SpreadSheet sheet)
        Checks whether we can append the specified spreadsheet to the existing file.
        Specified by:
        canAppend in interface AppendableSpreadSheetWriter
        Parameters:
        sheet - the spreadsheet to append to the existing one
        Returns:
        true if appending is possible
      • setAppending

        public void setAppending​(boolean value)
        Sets whether the next write call is to append the data to the existing file.
        Specified by:
        setAppending in interface AppendableSpreadSheetWriter
        Parameters:
        value - true if to append
      • isAppending

        public boolean isAppending()
        Returns whether the next spreadsheet will get appended.
        Specified by:
        isAppending in interface AppendableSpreadSheetWriter
        Returns:
        true if append is active
      • appendingTipText

        public String appendingTipText()
        Returns the tip text for this property.
        Specified by:
        appendingTipText in interface AppendableSpreadSheetWriter
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • setKeepExisting

        public void setKeepExisting​(boolean value)
        Sets whether to keep any existing file on first execution.
        Specified by:
        setKeepExisting in interface AppendableSpreadSheetWriter
        Parameters:
        value - if true then existing file is kept
      • getKeepExisting

        public boolean getKeepExisting()
        Returns whether any existing file is kept on first execution.
        Specified by:
        getKeepExisting in interface AppendableSpreadSheetWriter
        Returns:
        true if existing file is kept
      • keepExistingTipText

        public String keepExistingTipText()
        Returns the tip text for this property.
        Specified by:
        keepExistingTipText in interface AppendableSpreadSheetWriter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFileExists

        public void setFileExists​(boolean value)
        Sets whether the output file already exists.
        Specified by:
        setFileExists in interface AppendableSpreadSheetWriter
        Parameters:
        value - true if the output file already exists
      • getFileExists

        public boolean getFileExists()
        Returns whether the output file already exists.
        Specified by:
        getFileExists in interface AppendableSpreadSheetWriter
        Returns:
        true if the output file already exists
      • determineTableName

        protected String determineTableName​(SpreadSheet sheet)
        Determines the name for the table. Uses the project name if sheet has no name set and no table is set.
        Parameters:
        sheet - the sheet to determine the name for
        Returns:
        the name for the table
        See Also:
        getTableName()
      • doWriteHeader

        protected boolean doWriteHeader​(Row header,
                                        String filename)
        Writes the header.
        Parameters:
        header - the header row to write
        filename - the file to write the header to
      • writeHeader

        protected boolean writeHeader​(Row header,
                                      String filename)
        Writes the header, if necessary.
        Parameters:
        header - the header row to write
        filename - the file to write the header to
      • doWrite

        protected boolean doWrite​(Row content,
                                  String filename)
        Performs the actual writing. The caller must ensure that the writer gets closed.
        Parameters:
        content - the row to write
        filename - the file to write the spreadsheet to
        Returns:
        true if successfully written
      • doWrite

        protected boolean doWrite​(SpreadSheet content,
                                  String filename)
        Performs the actual writing. The caller must ensure that the writer gets closed.

        Default implementation returns always false.
        Overrides:
        doWrite in class AbstractSpreadSheetWriter
        Parameters:
        content - the spreadsheet to write
        filename - the file to write the spreadsheet to
        Returns:
        true if successfully written
      • isIncremental

        public boolean isIncremental()
        Returns whether the writer can write data incrementally.
        Specified by:
        isIncremental in interface IncrementalSpreadSheetWriter
        Returns:
        true if data can be written incrementally
      • write

        public boolean write​(Row content,
                             File file)
        Writes the given content to the specified file.
        Specified by:
        write in interface IncrementalSpreadSheetWriter
        Parameters:
        content - the content to write
        file - the file to write to
        Returns:
        true if successfully written
      • write

        public boolean write​(Row content,
                             String filename)
        Writes the spreadsheet to the given file.
        Specified by:
        write in interface IncrementalSpreadSheetWriter
        Parameters:
        content - the spreadsheet to write
        filename - the file to write the spreadsheet to
        Returns:
        true if successfully written