net.sf.excelutils
Class ExcelParser

java.lang.Object
  extended bynet.sf.excelutils.ExcelParser

public class ExcelParser
extends java.lang.Object

ExcelParser is a class which can parse the Excel template
to genrate reports.

Version:
$Revision: 1.7 $ $Date: 2005/11/03 03:35:19 $
Author:
rainsoft

Field Summary
static java.lang.String KEY_TAG
           
static java.util.Map tagPackageMap
           
static java.lang.String VALUED_DELIM
           
static java.lang.String VALUED_DELIM2
           
 
Constructor Summary
ExcelParser()
           
 
Method Summary
static java.lang.reflect.Field[] getBeanProperties(java.lang.Class clazz)
          get properties of the JavaBean
static DynaProperty[] getBeanProperties(DynaClass clazz)
           
static java.util.Iterator getIterator(java.lang.Object collection)
          get Iterator from the object
static int getShiftNum(int old_tagend, int tagstart)
          get shift Num
static int getSkipNum(int tagstart, int tagend)
          get Skip Num
static ITag getTagClass(java.lang.String str)
          get a instance by the tag name.
static java.lang.Object getValue(java.lang.Object context, java.lang.String expr)
          get the value from context by the expression
static int parse(java.lang.Object context, HSSFSheet sheet, int fromRow, int toRow)
          parse the Excel template
static void parseCell(java.lang.Object context, HSSFSheet sheet, HSSFRow row, HSSFCell cell)
          parse the cell
static java.lang.Object parseExpr(java.lang.Object context, java.lang.String expr)
          parse the expression ${model[${index}]} only one ${} and startWith ${ endWith }
static java.lang.Object parseStr(java.lang.Object context, java.lang.String str)
          parse complex expression ${${}}aaa${}
static java.lang.Object parseStr(java.lang.Object context, java.lang.String str, boolean quot)
          parse complex expression ${${}}aaa${}
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALUED_DELIM

public static final java.lang.String VALUED_DELIM
See Also:
Constant Field Values

VALUED_DELIM2

public static final java.lang.String VALUED_DELIM2
See Also:
Constant Field Values

KEY_TAG

public static final java.lang.String KEY_TAG
See Also:
Constant Field Values

tagPackageMap

public static java.util.Map tagPackageMap
Constructor Detail

ExcelParser

public ExcelParser()
Method Detail

parse

public static int parse(java.lang.Object context,
                        HSSFSheet sheet,
                        int fromRow,
                        int toRow)
parse the Excel template

Parameters:
context - data object
sheet - Excel sheet
fromRow - the start
toRow - the end
Returns:
int skip number

getTagClass

public static ITag getTagClass(java.lang.String str)
get a instance by the tag name.

Parameters:
str - tag name
Returns:
ITag instance

getValue

public static java.lang.Object getValue(java.lang.Object context,
                                        java.lang.String expr)
get the value from context by the expression

Parameters:
expr -
context - data object
Returns:
Object the value of the expr

parseExpr

public static java.lang.Object parseExpr(java.lang.Object context,
                                         java.lang.String expr)
parse the expression ${model[${index}]} only one ${} and startWith ${ endWith }

Parameters:
context - data object
expr -
Returns:
the value of the expr

parseStr

public static java.lang.Object parseStr(java.lang.Object context,
                                        java.lang.String str)
parse complex expression ${${}}aaa${}

Parameters:
context -
str -
Returns:
value of the str

parseStr

public static java.lang.Object parseStr(java.lang.Object context,
                                        java.lang.String str,
                                        boolean quot)
parse complex expression ${${}}aaa${}

Parameters:
context -
str -
quot - string needs quotation or not
Returns:
value of the str

parseCell

public static void parseCell(java.lang.Object context,
                             HSSFSheet sheet,
                             HSSFRow row,
                             HSSFCell cell)
parse the cell

Parameters:
context - data object
cell - excel cell

getBeanProperties

public static java.lang.reflect.Field[] getBeanProperties(java.lang.Class clazz)
get properties of the JavaBean

Parameters:
clazz - JavaBean
Returns:
fields in the javabean

getBeanProperties

public static DynaProperty[] getBeanProperties(DynaClass clazz)

getIterator

public static java.util.Iterator getIterator(java.lang.Object collection)
get Iterator from the object

Parameters:
collection -
Returns:
Iterator of the object

getSkipNum

public static int getSkipNum(int tagstart,
                             int tagend)
get Skip Num

Parameters:
tagstart -
tagend -
Returns:
skip number

getShiftNum

public static int getShiftNum(int old_tagend,
                              int tagstart)
get shift Num

Parameters:
old_tagend -
tagstart -
Returns:
shift number


Copyright (C) 200-2005 The ExcelUtils Project.