weka.core.converters
Class ExcelSaver

java.lang.Object
  extended by weka.core.converters.AbstractSaver
      extended by weka.core.converters.AbstractFileSaver
          extended by weka.core.converters.ExcelSaver
All Implemented Interfaces:
Serializable, weka.core.CapabilitiesHandler, weka.core.converters.BatchConverter, weka.core.converters.FileSourcedConverter, weka.core.converters.Saver, weka.core.EnvironmentHandler, weka.core.OptionHandler, weka.core.RevisionHandler

public class ExcelSaver
extends weka.core.converters.AbstractFileSaver
implements weka.core.converters.BatchConverter

Writes to a destination that is in MS Excel spreadsheet format (97-2007).
For instance for spreadsheets that can be read with the Microsoft Office Suite.

Valid options are:

 -M <str>
  The string representing a missing value.
  (default: ?)
 -i <the input file>
  The input file
 -o <the output file>
  The output file

For a tutorial on Apache POI/HSSF, see:
http://poi.apache.org/spreadsheet/how-to.html

Version:
$Revision: 8109 $
Author:
FracPete (fracpete at waikato dot ac dot nz)
See Also:
Saver, Serialized Form

Field Summary
 
Fields inherited from interface weka.core.converters.Saver
BATCH, INCREMENTAL, NONE
 
Constructor Summary
ExcelSaver()
          Constructor.
 
Method Summary
 weka.core.Capabilities getCapabilities()
          Returns the Capabilities of this saver.
 String getFileDescription()
          Returns a description of the file type.
 String[] getFileExtensions()
          Gets all the file extensions used for this type of file.
 String getMissingValue()
          Returns the current placeholder for missing values.
 String[] getOptions()
          Gets the current settings of the Classifier.
 String getRevision()
          Returns the revision string.
 String globalInfo()
          Returns a string describing this Saver.
 Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(String[] args)
          Main method.
 String missingValueTipText()
          Returns the tip text for this property.
 void resetOptions()
          Resets the Saver.
 boolean retrieveUseOOXML()
          Returns whether to use OOXML or binary format.
 void setFile(File outputFile)
          Sets the destination file.
 void setMissingValue(String value)
          Sets the placeholder for missing values.
 void setOptions(String[] options)
          Parses a given list of options.
 void setUseOOXML(boolean value)
          Sets whether to use OOXML or binary format.
 void writeBatch()
          Writes a Batch of instances.
 
Methods inherited from class weka.core.converters.AbstractFileSaver
cancel, filePrefix, getFileExtension, getUseRelativePath, getWriter, resetWriter, retrieveDir, retrieveFile, runFileSaver, setDestination, setDestination, setDir, setDirAndPrefix, setEnvironment, setFilePrefix, setUseRelativePath, useRelativePathTipText
 
Methods inherited from class weka.core.converters.AbstractSaver
getInstances, getWriteMode, resetStructure, setInstances, setRetrieval, setStructure, writeIncremental
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExcelSaver

public ExcelSaver()
Constructor.

Method Detail

globalInfo

public String globalInfo()
Returns a string describing this Saver.

Returns:
a description of the Saver suitable for displaying in the explorer/experimenter gui

listOptions

public Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface weka.core.OptionHandler
Overrides:
listOptions in class weka.core.converters.AbstractFileSaver
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(String[] options)
                throws Exception
Parses a given list of options.

Valid options are:

 -M <str>
  The string representing a missing value.
  (default: ?)
 -i <the input file>
  The input file
 -o <the output file>
  The output file

Specified by:
setOptions in interface weka.core.OptionHandler
Overrides:
setOptions in class weka.core.converters.AbstractFileSaver
Parameters:
options - the list of options as an array of strings
Throws:
Exception - if an option is not supported

getOptions

public String[] getOptions()
Gets the current settings of the Classifier.

Specified by:
getOptions in interface weka.core.OptionHandler
Overrides:
getOptions in class weka.core.converters.AbstractFileSaver
Returns:
an array of strings suitable for passing to setOptions

setMissingValue

public void setMissingValue(String value)
Sets the placeholder for missing values.

Parameters:
value - the placeholder

getMissingValue

public String getMissingValue()
Returns the current placeholder for missing values.

Returns:
the placeholder

missingValueTipText

public String missingValueTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

resetOptions

public void resetOptions()
Resets the Saver.

Overrides:
resetOptions in class weka.core.converters.AbstractFileSaver

getFileDescription

public String getFileDescription()
Returns a description of the file type.

Specified by:
getFileDescription in interface weka.core.converters.FileSourcedConverter
Specified by:
getFileDescription in class weka.core.converters.AbstractFileSaver
Returns:
a short file description

getFileExtensions

public String[] getFileExtensions()
Gets all the file extensions used for this type of file.

Specified by:
getFileExtensions in interface weka.core.converters.FileSourcedConverter
Overrides:
getFileExtensions in class weka.core.converters.AbstractFileSaver
Returns:
the file extensions

setUseOOXML

public void setUseOOXML(boolean value)
Sets whether to use OOXML or binary format.

Parameters:
value - if true then OOXML format is used

retrieveUseOOXML

public boolean retrieveUseOOXML()
Returns whether to use OOXML or binary format.

Returns:
true if OOXML is used

setFile

public void setFile(File outputFile)
             throws IOException
Sets the destination file.

Specified by:
setFile in interface weka.core.converters.FileSourcedConverter
Specified by:
setFile in interface weka.core.converters.Saver
Overrides:
setFile in class weka.core.converters.AbstractFileSaver
Parameters:
outputFile - the destination file.
Throws:
IOException - throws an IOException if file cannot be set

getCapabilities

public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this saver.

Specified by:
getCapabilities in interface weka.core.CapabilitiesHandler
Overrides:
getCapabilities in class weka.core.converters.AbstractSaver
Returns:
the capabilities of this object
See Also:
Capabilities

writeBatch

public void writeBatch()
                throws IOException
Writes a Batch of instances.

Specified by:
writeBatch in interface weka.core.converters.Saver
Specified by:
writeBatch in class weka.core.converters.AbstractSaver
Throws:
IOException - throws IOException if saving in batch mode is not possible

getRevision

public String getRevision()
Returns the revision string.

Specified by:
getRevision in interface weka.core.RevisionHandler
Returns:
the revision

main

public static void main(String[] args)
Main method.

Parameters:
args - should contain the options of a Saver.


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.