Generic Excel File(XLSX) Reader

com.myjeeva.poi
Class ExcelWorkSheetHandler<T>

java.lang.Object
  extended by com.myjeeva.poi.ExcelWorkSheetHandler<T>
All Implemented Interfaces:
XSSFSheetXMLHandler.SheetContentsHandler

public class ExcelWorkSheetHandler<T>
extends Object
implements XSSFSheetXMLHandler.SheetContentsHandler

Generic Excel WorkSheet handler

Author:
Jeevanandam Madanagopal

Constructor Summary
ExcelWorkSheetHandler(Class<T> type, Map<String,String> cellMapping)
          Constructor

For Example: Reading rows (zero based) starting from Zero
ExcelWorkSheetHandler<PersonVO> workSheetHandler = new ExcelWorkSheetHandler<PersonVO>(PersonVO.class, cellMapping);
ExcelWorkSheetHandler(Class<T> type, Map<String,String> cellMapping, int skipRows)
          Constructor

For Example: Reading rows (zero based) starting from Row 11
ExcelWorkSheetHandler<PersonVO> workSheetHandler = new ExcelWorkSheetHandler<PersonVO>(PersonVO.class, cellMapping, 10);
 
Method Summary
 void cell(String cellReference, String formattedValue)
           
 void endRow()
           
 List<T> getValueList()
          Returns Value List (List<T>) read from Excel Workbook, Row represents one Object in a List.
 void headerFooter(String text, boolean isHeader, String tagName)
          Currently not considered for implementation
 boolean isVerifiyHeader()
          Returns Excel Header check state, default it is enabled
 void setVerifiyHeader(boolean verifiyHeader)
          To set the Excel Header check state, default it is enabled
 void startRow(int rowNum)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExcelWorkSheetHandler

public ExcelWorkSheetHandler(Class<T> type,
                             Map<String,String> cellMapping)
Constructor

For Example: Reading rows (zero based) starting from Zero
ExcelWorkSheetHandler<PersonVO> workSheetHandler = new ExcelWorkSheetHandler<PersonVO>(PersonVO.class, cellMapping);

Parameters:
type - a Class object
cellMapping - a Map object

ExcelWorkSheetHandler

public ExcelWorkSheetHandler(Class<T> type,
                             Map<String,String> cellMapping,
                             int skipRows)
Constructor

For Example: Reading rows (zero based) starting from Row 11
ExcelWorkSheetHandler<PersonVO> workSheetHandler = new ExcelWorkSheetHandler<PersonVO>(PersonVO.class, cellMapping, 10);

Parameters:
type - a Class object
cellMapping - a Map object
skipRows - a int object - Number rows to skip (zero based). default is 0
Method Detail

getValueList

public List<T> getValueList()
Returns Value List (List<T>) read from Excel Workbook, Row represents one Object in a List.

For Example:
List<PersonVO> persons = workSheetHandler.getValueList();

Returns:
List<T>

isVerifiyHeader

public boolean isVerifiyHeader()
Returns Excel Header check state, default it is enabled

Returns:
boolean

setVerifiyHeader

public void setVerifiyHeader(boolean verifiyHeader)
To set the Excel Header check state, default it is enabled

Parameters:
verifiyHeader - a boolean

startRow

public void startRow(int rowNum)
Specified by:
startRow in interface XSSFSheetXMLHandler.SheetContentsHandler
See Also:
XSSFSheetXMLHandler.SheetContentsHandler.startRow(int)

cell

public void cell(String cellReference,
                 String formattedValue)
Specified by:
cell in interface XSSFSheetXMLHandler.SheetContentsHandler
See Also:
XSSFSheetXMLHandler.SheetContentsHandler.cell(java.lang.String, java.lang.String)

endRow

public void endRow()
Specified by:
endRow in interface XSSFSheetXMLHandler.SheetContentsHandler
See Also:
XSSFSheetXMLHandler.SheetContentsHandler.endRow()

headerFooter

public void headerFooter(String text,
                         boolean isHeader,
                         String tagName)
Currently not considered for implementation

Specified by:
headerFooter in interface XSSFSheetXMLHandler.SheetContentsHandler
See Also:
XSSFSheetXMLHandler.SheetContentsHandler.headerFooter(java.lang.String, boolean, java.lang.String)

Generic Excel File(XLSX) Reader

Copyright © 2012 www.myjeeva.com, All rights reserved.

The copyright of the pages and contents on this website is with myjeeva.com and the content is licensed under Creative Commons Attribution-Share Alike 3.0 Unported License. Libraries and code snippets on myjeeva.com has license information.