[Home] DMelt member access. Java source code: com.jstatcom.io.ExcelHelper
/*
* Copyright (C) 2005 Markus Kraetzig
* Created on 21.10.2005
*/
package com.jstatcom.io;
import java.util.List;
import jxl.Cell;
import jxl.CellType;
import jxl.DateCell;
import jxl.NumberCell;
import jxl.Sheet;
import jxl.Workbook;
/**
* Helper methods for dealing with Excel files.
*
* @author Markus Kraetzig
*/
public final class ExcelHelper {
/**
* 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.
*
* @param w
* the workbook
* @param sheetIndex
* index of the sheet
* @param firstAsDateCol
* whether first column should be skipped, often it contains date
* coding
* @param firstColList
* list that is filled with elements (usually dates) from the
* first column if firstAsDateCol == true, if
* null then it is ignored
* @param 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
* @return double array with data
* @throws IllegalArgumentException
* if null argument or invalid sheetIndex
*/
public static double[][] extractNumberArray(Workbook w, int sheetIndex,
boolean firstAsDateCol, List