MXUnit 2.1.3 (Generated: 09/27/2012)

mxunit.framework
Class POIUtility

WEB-INF.cftags.component
        extended by mxunit.framework.POIUtility

public class POIUtility
extends WEB-INF.cftags.component

Handles the reading and writing of Microsoft Excel files using POI and ColdFusion.


Constructor Summary
Init()
          Returns an initialized POI Utility instance
 
Method Summary
 any Debug()
private any GetCellStyle(any WorkBook, struct CSS)
          Takes the standardized CSS object and creates an Excel cell style
 struct GetNewSheetStruct()
          Returns a default structure of what this Component is expecting for a sheet definition when WRITING Excel files
private struct ParseRawCSS([string CSS=''])
          This takes raw HTML-style CSS and returns a default CSS structure with overwritten parsed values
 any ReadExcel(string FilePath, [boolean HasHeaderRow='false'], [numeric SheetIndex='-1'])
          Reads an Excel file into an array of strutures that contains the Excel file information OR if a specific sheet index is passed in, only that sheet object is returned
 struct ReadExcelSheet(any WorkBook, [numeric SheetIndex='0'], [boolean HasHeaderRow='false'])
          Takes an Excel workbook and reads the given sheet (by index) into a structure
 void WriteExcel(string FilePath, any Sheets, [string Delimiters=','], [string HeaderCSS=''], [string RowCSS=''], [string AltRowCSS=''])
          Takes an array of 'Sheet' structure objects and writes each of them to a tab in the Excel file
 void WriteExcelSheet(any WorkBook, any Query, [string ColumnList='[runtime expression]'], [string ColumnNames=''], [string SheetName='[runtime expression]'], [string Delimiters=','], [string HeaderCSS=''], [string RowCSS=''], [string AltRowCSS=''])
          Writes the given 'Sheet' structure to the given workbook
 void WriteSingleExcel(string FilePath, query Query, [string ColumnList='[runtime expression]'], [string ColumnNames=''], [string SheetName='Sheet 1'], [string Delimiters=','], [string HeaderCSS=''], [string RowCSS=''], [string AltRowCSS=''])
          Write the given query to an Excel file
private any getSheetColumnNames(any Sheet, boolean HasHeaderRow)
          gets or derives the column names for the sheet
 array readExcelToArray(string filePath, [boolean hasHeaderRow='false'], [numeric sheetIndex='0'])
          returns a 2D array of data
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

Init

public Init()
Returns an initialized POI Utility instance.

Method Detail

Debug

public any Debug()


GetCellStyle

private any GetCellStyle(any WorkBook, struct CSS)
Takes the standardized CSS object and creates an Excel cell style.

Parameters:
WorkBook
CSS

GetNewSheetStruct

public struct GetNewSheetStruct()
Returns a default structure of what this Component is expecting for a sheet definition when WRITING Excel files.


ParseRawCSS

private struct ParseRawCSS([string CSS=''])
This takes raw HTML-style CSS and returns a default CSS structure with overwritten parsed values.

Parameters:
CSS

ReadExcel

public any ReadExcel(string FilePath, [boolean HasHeaderRow='false'], [numeric SheetIndex='-1'])
Reads an Excel file into an array of strutures that contains the Excel file information OR if a specific sheet index is passed in, only that sheet object is returned.

Parameters:
FilePath - The expanded file path of the Excel file.
HasHeaderRow - Flags the Excel files has using the first data row a header column. If so, this column will be excluded from the resultant query.
SheetIndex - If passed in, only that sheet object will be returned (not an array of sheet objects).

ReadExcelSheet

public struct ReadExcelSheet(any WorkBook, [numeric SheetIndex='0'], [boolean HasHeaderRow='false'])
Takes an Excel workbook and reads the given sheet (by index) into a structure.

Parameters:
WorkBook - This is a workbook object created by the POI API.
SheetIndex - This is the index of the sheet within the passed in workbook. This is a ZERO-based index (coming from a Java object).
HasHeaderRow - This flags the sheet as having a header row or not (if so, it will NOT be read into the query).

WriteExcel

public void WriteExcel(string FilePath, any Sheets, [string Delimiters=','], [string HeaderCSS=''], [string RowCSS=''], [string AltRowCSS=''])
Takes an array of 'Sheet' structure objects and writes each of them to a tab in the Excel file.

Parameters:
FilePath - This is the expanded path of the Excel file.
Sheets - This is an array of the data that is needed for each sheet of the excel OR it is a single Sheet object. Each 'Sheet' will be a structure containing the Query, ColumnList, ColumnNames, and SheetName.
Delimiters - The list of delimiters used for the column list and column name arguments.
HeaderCSS - Defines the limited CSS available for the header row (if a header row is used).
RowCSS - Defines the limited CSS available for the non-header rows.
AltRowCSS - Defines the limited CSS available for the alternate non-header rows. This style overwrites parts of the RowCSS.

WriteExcelSheet

public void WriteExcelSheet(any WorkBook, any Query, [string ColumnList='[runtime expression]'], [string ColumnNames=''], [string SheetName='[runtime expression]'], [string Delimiters=','], [string HeaderCSS=''], [string RowCSS=''], [string AltRowCSS=''])
Writes the given 'Sheet' structure to the given workbook.

Parameters:
WorkBook - This is the Excel workbook that will create the sheets.
Query - This is the query from which we will get the data.
ColumnList - This is list of columns provided in custom-ordered.
ColumnNames - This the the list of optional header-row column names. If this is not provided, no header row is used.
SheetName - This is the optional name that appears in this sheet's tab.
Delimiters - The list of delimiters used for the column list and column name arguments.
HeaderCSS - Defines the limited CSS available for the header row (if a header row is used).
RowCSS - Defines the limited CSS available for the non-header rows.
AltRowCSS - Defines the limited CSS available for the alternate non-header rows. This style overwrites parts of the RowCSS.

WriteSingleExcel

public void WriteSingleExcel(string FilePath, query Query, [string ColumnList='[runtime expression]'], [string ColumnNames=''], [string SheetName='Sheet 1'], [string Delimiters=','], [string HeaderCSS=''], [string RowCSS=''], [string AltRowCSS=''])
Write the given query to an Excel file.

Parameters:
FilePath - This is the expanded path of the Excel file.
Query - This is the query from which we will get the data for the Excel file.
ColumnList - This is list of columns provided in custom-order.
ColumnNames - This the the list of optional header-row column names. If this is not provided, no header row is used.
SheetName - This is the optional name that appears in the first (and only) workbook tab.
Delimiters - The list of delimiters used for the column list and column name arguments.
HeaderCSS - Defines the limited CSS available for the header row (if a header row is used).
RowCSS - Defines the limited CSS available for the non-header rows.
AltRowCSS - Defines the limited CSS available for the alternate non-header rows. This style overwrites parts of the RowCSS.

getSheetColumnNames

private any getSheetColumnNames(any Sheet, boolean HasHeaderRow)
gets or derives the column names for the sheet

Parameters:
Sheet
HasHeaderRow

readExcelToArray

public array readExcelToArray(string filePath, [boolean hasHeaderRow='false'], [numeric sheetIndex='0'])
returns a 2D array of data

Parameters:
filePath - full path to file
hasHeaderRow - whether the first row is a header row. If so, the values in the first row will be used as column names; otherwise, columns will be derived
sheetIndex

MXUnit 2.1.3 (Generated: 09/27/2012)