public class ExcelParser extends Parser
| Constructor and Description |
|---|
ExcelParser(Class clazz,
ExcelFactoryType excelFactoryType,
File file)
Initialize the excel parser.
This constructor will also save the annotated class fields in to a map for future use. |
| Modifier and Type | Method and Description |
|---|---|
Object |
getBeanForARow(org.apache.poi.ss.usermodel.Row row)
Fetches the cell details from the each row and sets its values based on
the instance variable defined by the annotation.
|
boolean |
isBreakAfterEmptyRow() |
boolean |
isSkipHeader() |
List<Object> |
parse()
Reads and convert valid excel file into required format
Will only process the first sheet, split multiple sheets into multiple files. |
void |
setBreakAfterEmptyRow(boolean breakAfterEmptyRow) |
void |
setSkipHeader(boolean skipHeader) |
List<String> |
validateFormat() |
dateParser, getCellValue, getExcelFactoryType, getHeadersMap, getWorkbook, isEmptyRowpublic ExcelParser(Class clazz, ExcelFactoryType excelFactoryType, File file) throws Exception
clazz - The Excel Bean class.excelFactoryType - file - that needs to be parsed.Exception - exceptionpublic List<Object> parse() throws org.apache.poi.openxml4j.exceptions.InvalidFormatException, IOException, InstantiationException, IllegalAccessException, IllegalArgumentException, ParseException
IOException - IOExceptionorg.apache.poi.openxml4j.exceptions.InvalidFormatException - InvalidFormatExceptionParseException - ParseExceptionIllegalArgumentException - IllegalArgumentExceptionIllegalAccessException - IllegalAccessExceptionInstantiationException - InstantiationExceptionpublic Object getBeanForARow(org.apache.poi.ss.usermodel.Row row) throws InstantiationException, IllegalAccessException, IllegalArgumentException, ParseException
row - excel rowIllegalAccessException - illegal access exceptionInstantiationException - instantiation exceptionParseException - parse exceptionIllegalArgumentException - illegal argument exceptionpublic boolean isBreakAfterEmptyRow()
public void setBreakAfterEmptyRow(boolean breakAfterEmptyRow)
public boolean isSkipHeader()
public void setSkipHeader(boolean skipHeader)
Copyright © 2019 Gizbel Technologies Private Limited. All rights reserved.