com.jstatcom.io
Class ExcelHelper

java.lang.Object
  extended by com.jstatcom.io.ExcelHelper

public final class ExcelHelper
extends java.lang.Object

Helper methods for dealing with Excel files.

Author:
Markus Kraetzig

Constructor Summary
ExcelHelper()
           
 
Method Summary
static double[][] extractNumberArray(jxl.Workbook w, int sheetIndex, boolean firstAsDateCol, java.util.List<java.lang.Object> firstColList, java.util.List<java.lang.String> labelsList)
          Extracts a double array from an excel sheet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExcelHelper

public ExcelHelper()
Method Detail

extractNumberArray

public static double[][] extractNumberArray(jxl.Workbook w,
                                            int sheetIndex,
                                            boolean firstAsDateCol,
                                            java.util.List<java.lang.Object> firstColList,
                                            java.util.List<java.lang.String> labelsList)
Extracts a double array from an excel sheet. It first checks the highest and lowest row indices with numbers and then extracts all cell data in between to a number array. All non numbers within are coded NaN.

Parameters:
w - the workbook
sheetIndex - index of the sheet
firstAsDateCol - whether first column should be skipped, often it contains date coding
firstColList - list that is filled with elements (usually dates) from the first column if firstAsDateCol == true, if null then it is ignored
labelsList - list that is filled with labels for each column, the first CellType.LABEL value in each column is used; if firstAsDateCol == true then the first column is skipped, if null then it is ignored
Returns:
double array with data
Throws:
java.lang.IllegalArgumentException - if null argument or invalid sheetIndex