Package com.simplicite.util.tools
Class ExcelTool
- java.lang.Object
-
- com.simplicite.util.tools.ExcelTool
-
public class ExcelTool extends java.lang.Object
Microsoft Excel binary using Apache POI toolbox
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExcelTool.ExcelCell
Cell with Simplicite attributesstatic class
ExcelTool.ExcelRow
Row with cells
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BGCOLOR
Excel exports stylesstatic short
COLOR_BLUE
Bluestatic short
COLOR_GREEN
Greenstatic short
COLOR_GREY
Greystatic short
COLOR_RED
Redstatic short
COLOR_WHITE
Whitestatic java.lang.String
DATE_CELL_BLUE
Date cell bluestatic java.lang.String
DATE_CELL_GREEN
Date cell greenstatic java.lang.String
DATE_CELL_GREY
Date cell greystatic java.lang.String
DATE_CELL_RED
Date cell redstatic java.lang.String
DATE_CELL_WHITE
Date cell whitestatic java.lang.String
DATETIME_CELL_BLUE
Date and time cell bluestatic java.lang.String
DATETIME_CELL_GREEN
Date and time cell greenstatic java.lang.String
DATETIME_CELL_GREY
Date and time cell greystatic java.lang.String
DATETIME_CELL_RED
Date and time cell redstatic java.lang.String
DATETIME_CELL_WHITE
Date and time cell whitestatic java.lang.String
FORMULA_CELL_BLUE
Formula cell bluestatic java.lang.String
FORMULA_CELL_GREEN
Formula cell greenstatic java.lang.String
FORMULA_CELL_GREY
Formula cell greystatic java.lang.String
FORMULA_CELL_RED
Formula cell redstatic java.lang.String
FORMULA_CELL_WHITE
Formula cell whitestatic java.lang.String
FORMULA_HEAD_GREY
Formula head cell greystatic java.lang.String
FORMULA_HEAD_WHITE
Formula head cell whitestatic java.lang.String
INTEGER_CELL_BLUE
Integer cell bluestatic java.lang.String
INTEGER_CELL_GREEN
Integer cell greenstatic java.lang.String
INTEGER_CELL_GREY
Integer cell greystatic java.lang.String
INTEGER_CELL_RED
Integer cell redstatic java.lang.String
INTEGER_CELL_WHITE
Integer cell whitestatic java.lang.String
INTEGER_CHF_CELL_BLUE
Integer cell blue with CHF signstatic java.lang.String
INTEGER_CHF_CELL_GREEN
Integer cell green with CHF signstatic java.lang.String
INTEGER_CHF_CELL_GREY
Integer cell grey with CHF signstatic java.lang.String
INTEGER_CHF_CELL_RED
Integer cell red with CHF signstatic java.lang.String
INTEGER_CHF_CELL_WHITE
Integer cell white with CHF signstatic java.lang.String
INTEGER_DOLLAR_CELL_BLUE
Integer cell blue with Dollar signstatic java.lang.String
INTEGER_DOLLAR_CELL_GREEN
Integer cell green with Dollar signstatic java.lang.String
INTEGER_DOLLAR_CELL_GREY
Integer cell grey with Dollar signstatic java.lang.String
INTEGER_DOLLAR_CELL_RED
Integer cell red with Dollar signstatic java.lang.String
INTEGER_DOLLAR_CELL_WHITE
Integer cell white with Dollar signstatic java.lang.String
INTEGER_EURO_CELL_BLUE
Integer cell blue with Euro signstatic java.lang.String
INTEGER_EURO_CELL_GREEN
Integer cell green with Euro signstatic java.lang.String
INTEGER_EURO_CELL_GREY
Integer cell grey with Euro signstatic java.lang.String
INTEGER_EURO_CELL_RED
Integer cell red with Euro signstatic java.lang.String
INTEGER_EURO_CELL_WHITE
Integer cell white with Euro signstatic java.lang.String
NUMERIC_CELL_BLUE
Numeric cell bluestatic java.lang.String
NUMERIC_CELL_GREEN
Numeric cell greenstatic java.lang.String
NUMERIC_CELL_GREY
Numeric cell greystatic java.lang.String
NUMERIC_CELL_RED
Numeric cell redstatic java.lang.String
NUMERIC_CELL_WHITE
Numeric cell whitestatic java.lang.String
NUMERIC_CHF_CELL_BLUE
Numeric cell blue with CHF signstatic java.lang.String
NUMERIC_CHF_CELL_GREEN
Numeric cell green with CHF signstatic java.lang.String
NUMERIC_CHF_CELL_GREY
Numeric cell grey with CHF signstatic java.lang.String
NUMERIC_CHF_CELL_RED
Numeric cell red with CHF signstatic java.lang.String
NUMERIC_CHF_CELL_WHITE
Numeric cell white with CHF signstatic java.lang.String
NUMERIC_DOLLAR_CELL_BLUE
Numeric cell blue with Dollar signstatic java.lang.String
NUMERIC_DOLLAR_CELL_GREEN
Numeric cell green with Dollar signstatic java.lang.String
NUMERIC_DOLLAR_CELL_GREY
Numeric cell grey with Dollar signstatic java.lang.String
NUMERIC_DOLLAR_CELL_RED
Numeric cell red with Dollar signstatic java.lang.String
NUMERIC_DOLLAR_CELL_WHITE
Numeric cell white with Dollar signstatic java.lang.String
NUMERIC_EURO_CELL_BLUE
Numeric cell blue with Euro signstatic java.lang.String
NUMERIC_EURO_CELL_GREEN
Numeric cell green with Euro signstatic java.lang.String
NUMERIC_EURO_CELL_GREY
Numeric cell grey with Euro signstatic java.lang.String
NUMERIC_EURO_CELL_RED
Numeric cell red with Euro signstatic java.lang.String
NUMERIC_EURO_CELL_WHITE
Numeric cell white with Euro signstatic java.lang.String
NUMERIC_HEAD_GREY
Numeric head cell greystatic java.lang.String
NUMERIC_HEAD_WHITE
Numeric head cell whitestatic java.lang.String
STRING_CELL_BLUE
String cell bluestatic java.lang.String
STRING_CELL_GREEN
String cell greenstatic java.lang.String
STRING_CELL_GREY
String cell greystatic java.lang.String
STRING_CELL_RED
String cell redstatic java.lang.String
STRING_CELL_WHITE
String cell whitestatic java.lang.String
STRING_HEAD_GREY
String head cell greystatic java.lang.String
STRING_HEAD_WHITE
String head cell whitestatic org.apache.poi.ss.usermodel.CellType
TYPE_FORMULA
Formula typestatic org.apache.poi.ss.usermodel.CellType
TYPE_NUMERIC
Numeric typestatic org.apache.poi.ss.usermodel.CellType
TYPE_STRING
String type
-
Constructor Summary
Constructors Constructor Description ExcelTool()
Empty constructorExcelTool(boolean openxml)
Constructor (empty POI workbook)ExcelTool(byte[] data, boolean openxml)
Constructor (POI workbook from byte array data)ExcelTool(Grant g, DocumentDB doc)
Constructor (POI workbook from document)ExcelTool(java.io.File file)
Constructor (POI workbook from existing file)ExcelTool(java.io.InputStream in, boolean openxml)
Constructor (POI workbook from input stream)ExcelTool(java.io.InputStream in, int rowsAccess)
Constructor for huge export (OpenXML format) using a temp file to limit heap size.ExcelTool(java.lang.String path)
Constructor (POI workbook from existing file)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addJPEGPicture(byte[] data, org.apache.poi.ss.usermodel.Sheet sheet, int row, int col)
Add JPEG picturevoid
addPNGPicture(byte[] data, org.apache.poi.ss.usermodel.Sheet sheet, int row, int col)
Add PNG picturevoid
addRow(ObjectDB obj, java.util.List<ObjectField> fields, java.lang.String[] row, java.io.PrintWriter out)
Add a record to HTML outputorg.apache.poi.ss.usermodel.Row
addRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex)
Add an empty row to the sheetorg.apache.poi.ss.usermodel.Row
addRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex, ExcelTool.ExcelCell cell)
Add a row to the sheetorg.apache.poi.ss.usermodel.Row
addRow(org.apache.poi.ss.usermodel.Sheet sheet, ExcelTool.ExcelRow row)
Add a row to the sheetvoid
addRows(ObjectDB obj, java.util.List<ObjectField> fields, java.util.List<java.lang.String[]> rows)
Add a rows to Excel POIvoid
addRows(ObjectDB obj, java.util.List<ObjectField> fields, java.util.List<java.lang.String[]> rows, Link link)
Add a rows to Excel POIorg.apache.poi.ss.usermodel.Sheet
addSheet(java.lang.String label)
Add a sheet to workbookorg.apache.poi.ss.usermodel.Sheet
addSheet(java.lang.String label, int defaultRowHeight, int defaultCellWidth)
Add a sheet to workbookvoid
adjustSheet(org.apache.poi.ss.usermodel.Sheet sheet, int autoSizeColumns, int freezeRows)
Adjust sheet sizing.void
export(ObjectDB obj, java.lang.String mode, java.io.OutputStream out)
Export object form as Excel workbookvoid
export(ObjectDB obj, java.lang.String mode, java.lang.String format, java.io.OutputStream out)
Deprecated, for removal: This API element is subject to removal in a future version.java.lang.String
export(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, java.io.OutputStream out)
Export object list as Excel workbookvoid
export(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, java.lang.String format, java.io.OutputStream out)
Deprecated, for removal: This API element is subject to removal in a future version.void
generate(java.io.OutputStream out)
Generate workbook to specified output streambyte[]
generateToByteArray()
Generate workbook as byte arrayvoid
generateToFile(java.lang.String fileName)
Generate workbook to fileorg.apache.poi.ss.usermodel.CellStyle
getDateCellStyle(short bgcolor, boolean head)
Get date cell stylestatic org.apache.poi.ss.usermodel.CellStyle
getDateCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get date cell styleorg.apache.poi.ss.usermodel.CellStyle
getDateTimeCellStyle(short bgcolor, boolean head)
Get date and time cell stylestatic org.apache.poi.ss.usermodel.CellStyle
getDateTimeCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get date and time cell styleorg.apache.poi.ss.usermodel.CellStyle
getFormulaCellStyle(short bgcolor, boolean head)
Get date cell styleorg.apache.poi.ss.usermodel.CellStyle
getFormulaCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get formula cell styleorg.apache.poi.ss.usermodel.CellStyle
getNumericCellStyle(short bgcolor, boolean head)
Get string cell stylestatic org.apache.poi.ss.usermodel.CellStyle
getNumericCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get numeric cell stylestatic org.apache.poi.ss.usermodel.CellStyle
getNumericCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head, int precision, java.lang.String currency)
Get string cell styleorg.apache.poi.ss.usermodel.Sheet
getSheet(java.lang.String label)
Get Sheet by labelorg.apache.poi.ss.usermodel.CellStyle
getStringCellStyle(short bgcolor, boolean head)
Get string cell styleorg.apache.poi.ss.usermodel.CellStyle
getStringCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get string cell stylejava.util.Map<java.lang.String,org.apache.poi.ss.usermodel.CellStyle>
getStyles()
Get custom stylesorg.apache.poi.ss.usermodel.Workbook
getWorkbook()
Get workbookjava.util.Map<java.lang.String,org.apache.poi.ss.usermodel.CellStyle>
loadStyles()
ExcelTool.ExcelCell
newCell(int cellIndex, double value)
Get new cellExcelTool.ExcelCell
newCell(int cellIndex, float value)
Get new cellExcelTool.ExcelCell
newCell(int cellIndex, int value)
Get new cellExcelTool.ExcelCell
newCell(int cellIndex, ObjectField field, java.lang.String value)
Get new cellExcelTool.ExcelCell
newCell(int cellIndex, java.lang.String content)
Get new cellExcelTool.ExcelCell
newCell(int cellIndex, java.lang.String content, org.apache.poi.ss.usermodel.CellType type)
Get new cellExcelTool.ExcelCell
newCell(int cellIndex, java.lang.String content, org.apache.poi.ss.usermodel.CellType type, java.lang.String styleName)
Get new cellExcelTool.ExcelCell
newCell(int cellIndex, java.lang.String content, org.apache.poi.ss.usermodel.CellType type, java.lang.String styleName, ObjectField field)
Get new cellExcelTool.ExcelCell
newCell(int cellIndex, java.util.Date date, boolean withTime)
Get new cell for a datevoid
toHTML(ObjectDB obj, java.lang.String mode, java.io.PrintWriter out)
Deprecated, for removal: This API element is subject to removal in a future version.void
toHTML(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, java.io.PrintWriter out)
Deprecated, for removal: This API element is subject to removal in a future version.void
toPOI(ObjectDB obj, java.lang.String mode, java.io.OutputStream out)
Export object form as Excel workbook (binary format)java.lang.String
toPOI(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, java.io.OutputStream out)
Export object list as Excel workbook (binary format)void
updateFormulas(org.apache.poi.ss.usermodel.Sheet sheet)
Update formulas in sheet
-
-
-
Field Detail
-
BGCOLOR
public static final java.lang.String BGCOLOR
Excel exports styles- See Also:
- Constant Field Values
-
COLOR_WHITE
public static final short COLOR_WHITE
White
-
COLOR_BLUE
public static final short COLOR_BLUE
Blue
-
COLOR_RED
public static final short COLOR_RED
Red
-
COLOR_GREEN
public static final short COLOR_GREEN
Green
-
COLOR_GREY
public static final short COLOR_GREY
Grey
-
TYPE_STRING
public static final org.apache.poi.ss.usermodel.CellType TYPE_STRING
String type
-
TYPE_NUMERIC
public static final org.apache.poi.ss.usermodel.CellType TYPE_NUMERIC
Numeric type
-
TYPE_FORMULA
public static final org.apache.poi.ss.usermodel.CellType TYPE_FORMULA
Formula type
-
STRING_HEAD_WHITE
public static final java.lang.String STRING_HEAD_WHITE
String head cell white- See Also:
- Constant Field Values
-
STRING_HEAD_GREY
public static final java.lang.String STRING_HEAD_GREY
String head cell grey- See Also:
- Constant Field Values
-
NUMERIC_HEAD_WHITE
public static final java.lang.String NUMERIC_HEAD_WHITE
Numeric head cell white- See Also:
- Constant Field Values
-
NUMERIC_HEAD_GREY
public static final java.lang.String NUMERIC_HEAD_GREY
Numeric head cell grey- See Also:
- Constant Field Values
-
FORMULA_HEAD_WHITE
public static final java.lang.String FORMULA_HEAD_WHITE
Formula head cell white- See Also:
- Constant Field Values
-
FORMULA_HEAD_GREY
public static final java.lang.String FORMULA_HEAD_GREY
Formula head cell grey- See Also:
- Constant Field Values
-
STRING_CELL_WHITE
public static final java.lang.String STRING_CELL_WHITE
String cell white- See Also:
- Constant Field Values
-
STRING_CELL_BLUE
public static final java.lang.String STRING_CELL_BLUE
String cell blue- See Also:
- Constant Field Values
-
STRING_CELL_RED
public static final java.lang.String STRING_CELL_RED
String cell red- See Also:
- Constant Field Values
-
STRING_CELL_GREEN
public static final java.lang.String STRING_CELL_GREEN
String cell green- See Also:
- Constant Field Values
-
STRING_CELL_GREY
public static final java.lang.String STRING_CELL_GREY
String cell grey- See Also:
- Constant Field Values
-
INTEGER_CELL_WHITE
public static final java.lang.String INTEGER_CELL_WHITE
Integer cell white- See Also:
- Constant Field Values
-
INTEGER_CELL_BLUE
public static final java.lang.String INTEGER_CELL_BLUE
Integer cell blue- See Also:
- Constant Field Values
-
INTEGER_CELL_RED
public static final java.lang.String INTEGER_CELL_RED
Integer cell red- See Also:
- Constant Field Values
-
INTEGER_CELL_GREEN
public static final java.lang.String INTEGER_CELL_GREEN
Integer cell green- See Also:
- Constant Field Values
-
INTEGER_CELL_GREY
public static final java.lang.String INTEGER_CELL_GREY
Integer cell grey- See Also:
- Constant Field Values
-
INTEGER_EURO_CELL_WHITE
public static final java.lang.String INTEGER_EURO_CELL_WHITE
Integer cell white with Euro sign- See Also:
- Constant Field Values
-
INTEGER_EURO_CELL_BLUE
public static final java.lang.String INTEGER_EURO_CELL_BLUE
Integer cell blue with Euro sign- See Also:
- Constant Field Values
-
INTEGER_EURO_CELL_RED
public static final java.lang.String INTEGER_EURO_CELL_RED
Integer cell red with Euro sign- See Also:
- Constant Field Values
-
INTEGER_EURO_CELL_GREEN
public static final java.lang.String INTEGER_EURO_CELL_GREEN
Integer cell green with Euro sign- See Also:
- Constant Field Values
-
INTEGER_EURO_CELL_GREY
public static final java.lang.String INTEGER_EURO_CELL_GREY
Integer cell grey with Euro sign- See Also:
- Constant Field Values
-
INTEGER_DOLLAR_CELL_WHITE
public static final java.lang.String INTEGER_DOLLAR_CELL_WHITE
Integer cell white with Dollar sign- See Also:
- Constant Field Values
-
INTEGER_DOLLAR_CELL_BLUE
public static final java.lang.String INTEGER_DOLLAR_CELL_BLUE
Integer cell blue with Dollar sign- See Also:
- Constant Field Values
-
INTEGER_DOLLAR_CELL_RED
public static final java.lang.String INTEGER_DOLLAR_CELL_RED
Integer cell red with Dollar sign- See Also:
- Constant Field Values
-
INTEGER_DOLLAR_CELL_GREEN
public static final java.lang.String INTEGER_DOLLAR_CELL_GREEN
Integer cell green with Dollar sign- See Also:
- Constant Field Values
-
INTEGER_DOLLAR_CELL_GREY
public static final java.lang.String INTEGER_DOLLAR_CELL_GREY
Integer cell grey with Dollar sign- See Also:
- Constant Field Values
-
INTEGER_CHF_CELL_WHITE
public static final java.lang.String INTEGER_CHF_CELL_WHITE
Integer cell white with CHF sign- See Also:
- Constant Field Values
-
INTEGER_CHF_CELL_BLUE
public static final java.lang.String INTEGER_CHF_CELL_BLUE
Integer cell blue with CHF sign- See Also:
- Constant Field Values
-
INTEGER_CHF_CELL_RED
public static final java.lang.String INTEGER_CHF_CELL_RED
Integer cell red with CHF sign- See Also:
- Constant Field Values
-
INTEGER_CHF_CELL_GREEN
public static final java.lang.String INTEGER_CHF_CELL_GREEN
Integer cell green with CHF sign- See Also:
- Constant Field Values
-
INTEGER_CHF_CELL_GREY
public static final java.lang.String INTEGER_CHF_CELL_GREY
Integer cell grey with CHF sign- See Also:
- Constant Field Values
-
NUMERIC_CELL_WHITE
public static final java.lang.String NUMERIC_CELL_WHITE
Numeric cell white- See Also:
- Constant Field Values
-
NUMERIC_CELL_BLUE
public static final java.lang.String NUMERIC_CELL_BLUE
Numeric cell blue- See Also:
- Constant Field Values
-
NUMERIC_CELL_RED
public static final java.lang.String NUMERIC_CELL_RED
Numeric cell red- See Also:
- Constant Field Values
-
NUMERIC_CELL_GREEN
public static final java.lang.String NUMERIC_CELL_GREEN
Numeric cell green- See Also:
- Constant Field Values
-
NUMERIC_CELL_GREY
public static final java.lang.String NUMERIC_CELL_GREY
Numeric cell grey- See Also:
- Constant Field Values
-
NUMERIC_EURO_CELL_WHITE
public static final java.lang.String NUMERIC_EURO_CELL_WHITE
Numeric cell white with Euro sign- See Also:
- Constant Field Values
-
NUMERIC_EURO_CELL_BLUE
public static final java.lang.String NUMERIC_EURO_CELL_BLUE
Numeric cell blue with Euro sign- See Also:
- Constant Field Values
-
NUMERIC_EURO_CELL_RED
public static final java.lang.String NUMERIC_EURO_CELL_RED
Numeric cell red with Euro sign- See Also:
- Constant Field Values
-
NUMERIC_EURO_CELL_GREEN
public static final java.lang.String NUMERIC_EURO_CELL_GREEN
Numeric cell green with Euro sign- See Also:
- Constant Field Values
-
NUMERIC_EURO_CELL_GREY
public static final java.lang.String NUMERIC_EURO_CELL_GREY
Numeric cell grey with Euro sign- See Also:
- Constant Field Values
-
NUMERIC_DOLLAR_CELL_WHITE
public static final java.lang.String NUMERIC_DOLLAR_CELL_WHITE
Numeric cell white with Dollar sign- See Also:
- Constant Field Values
-
NUMERIC_DOLLAR_CELL_BLUE
public static final java.lang.String NUMERIC_DOLLAR_CELL_BLUE
Numeric cell blue with Dollar sign- See Also:
- Constant Field Values
-
NUMERIC_DOLLAR_CELL_RED
public static final java.lang.String NUMERIC_DOLLAR_CELL_RED
Numeric cell red with Dollar sign- See Also:
- Constant Field Values
-
NUMERIC_DOLLAR_CELL_GREEN
public static final java.lang.String NUMERIC_DOLLAR_CELL_GREEN
Numeric cell green with Dollar sign- See Also:
- Constant Field Values
-
NUMERIC_DOLLAR_CELL_GREY
public static final java.lang.String NUMERIC_DOLLAR_CELL_GREY
Numeric cell grey with Dollar sign- See Also:
- Constant Field Values
-
NUMERIC_CHF_CELL_WHITE
public static final java.lang.String NUMERIC_CHF_CELL_WHITE
Numeric cell white with CHF sign- See Also:
- Constant Field Values
-
NUMERIC_CHF_CELL_BLUE
public static final java.lang.String NUMERIC_CHF_CELL_BLUE
Numeric cell blue with CHF sign- See Also:
- Constant Field Values
-
NUMERIC_CHF_CELL_RED
public static final java.lang.String NUMERIC_CHF_CELL_RED
Numeric cell red with CHF sign- See Also:
- Constant Field Values
-
NUMERIC_CHF_CELL_GREEN
public static final java.lang.String NUMERIC_CHF_CELL_GREEN
Numeric cell green with CHF sign- See Also:
- Constant Field Values
-
NUMERIC_CHF_CELL_GREY
public static final java.lang.String NUMERIC_CHF_CELL_GREY
Numeric cell grey with CHF sign- See Also:
- Constant Field Values
-
FORMULA_CELL_WHITE
public static final java.lang.String FORMULA_CELL_WHITE
Formula cell white- See Also:
- Constant Field Values
-
FORMULA_CELL_BLUE
public static final java.lang.String FORMULA_CELL_BLUE
Formula cell blue- See Also:
- Constant Field Values
-
FORMULA_CELL_RED
public static final java.lang.String FORMULA_CELL_RED
Formula cell red- See Also:
- Constant Field Values
-
FORMULA_CELL_GREEN
public static final java.lang.String FORMULA_CELL_GREEN
Formula cell green- See Also:
- Constant Field Values
-
FORMULA_CELL_GREY
public static final java.lang.String FORMULA_CELL_GREY
Formula cell grey- See Also:
- Constant Field Values
-
DATE_CELL_WHITE
public static final java.lang.String DATE_CELL_WHITE
Date cell white- See Also:
- Constant Field Values
-
DATE_CELL_BLUE
public static final java.lang.String DATE_CELL_BLUE
Date cell blue- See Also:
- Constant Field Values
-
DATE_CELL_RED
public static final java.lang.String DATE_CELL_RED
Date cell red- See Also:
- Constant Field Values
-
DATE_CELL_GREEN
public static final java.lang.String DATE_CELL_GREEN
Date cell green- See Also:
- Constant Field Values
-
DATE_CELL_GREY
public static final java.lang.String DATE_CELL_GREY
Date cell grey- See Also:
- Constant Field Values
-
DATETIME_CELL_WHITE
public static final java.lang.String DATETIME_CELL_WHITE
Date and time cell white- See Also:
- Constant Field Values
-
DATETIME_CELL_BLUE
public static final java.lang.String DATETIME_CELL_BLUE
Date and time cell blue- See Also:
- Constant Field Values
-
DATETIME_CELL_RED
public static final java.lang.String DATETIME_CELL_RED
Date and time cell red- See Also:
- Constant Field Values
-
DATETIME_CELL_GREEN
public static final java.lang.String DATETIME_CELL_GREEN
Date and time cell green- See Also:
- Constant Field Values
-
DATETIME_CELL_GREY
public static final java.lang.String DATETIME_CELL_GREY
Date and time cell grey- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExcelTool
public ExcelTool()
Empty constructor
-
ExcelTool
public ExcelTool(boolean openxml) throws java.io.IOException
Constructor (empty POI workbook)- Parameters:
openxml
- Use OpenXML format (.xlsx)?- Throws:
java.io.IOException
-
ExcelTool
public ExcelTool(java.lang.String path) throws java.io.IOException
Constructor (POI workbook from existing file)- Parameters:
path
- File path- Throws:
java.io.IOException
-
ExcelTool
public ExcelTool(java.io.File file) throws java.io.IOException
Constructor (POI workbook from existing file)- Parameters:
file
- File- Throws:
java.io.IOException
-
ExcelTool
public ExcelTool(byte[] data, boolean openxml) throws java.io.IOException
Constructor (POI workbook from byte array data)- Parameters:
data
- Byte array dataopenxml
- Use OpenXML format (.xlsx)?- Throws:
java.io.IOException
-
ExcelTool
public ExcelTool(Grant g, DocumentDB doc) throws java.io.IOException
Constructor (POI workbook from document)- Parameters:
g
- Grantdoc
- Document- Throws:
java.io.IOException
-
ExcelTool
public ExcelTool(java.io.InputStream in, boolean openxml) throws java.io.IOException
Constructor (POI workbook from input stream)- Parameters:
in
- Input streamopenxml
- Use OpenXML format (.xlsx)?- Throws:
java.io.IOException
-
ExcelTool
public ExcelTool(java.io.InputStream in, int rowsAccess) throws java.io.IOException
Constructor for huge export (OpenXML format) using a temp file to limit heap size. This method does not allow random access to flushed rows, it is only dedicated to export data.- Parameters:
in
- Optional input streamrowsAccess
- window size of row access in memory. Older rows that are no longer in the window become inaccessible, as they are written to disk.- Throws:
java.io.IOException
-
-
Method Detail
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, ObjectField field, java.lang.String value)
Get new cell- Parameters:
cellIndex
- Cell indexfield
- Fieldvalue
- value
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, java.lang.String content)
Get new cell- Parameters:
cellIndex
- Cell indexcontent
- Cell content- Returns:
- Cell
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, int value)
Get new cell- Parameters:
cellIndex
- Cell indexvalue
- Cell integer content- Returns:
- Cell
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, float value)
Get new cell- Parameters:
cellIndex
- Cell indexvalue
- Cell float content- Returns:
- Cell
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, double value)
Get new cell- Parameters:
cellIndex
- Cell indexvalue
- Cell double content- Returns:
- Cell
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, java.util.Date date, boolean withTime)
Get new cell for a date- Parameters:
cellIndex
- Cell indexdate
- DatewithTime
- Date and time ?- Returns:
- Cell
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, java.lang.String content, org.apache.poi.ss.usermodel.CellType type)
Get new cell- Parameters:
cellIndex
- Cell indexcontent
- Cell contenttype
- Cell type
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, java.lang.String content, org.apache.poi.ss.usermodel.CellType type, java.lang.String styleName)
Get new cell- Parameters:
cellIndex
- Cell indexcontent
- Cell contenttype
- Cell typestyleName
- Cell style name- Returns:
- Cell
-
newCell
public ExcelTool.ExcelCell newCell(int cellIndex, java.lang.String content, org.apache.poi.ss.usermodel.CellType type, java.lang.String styleName, ObjectField field)
Get new cell- Parameters:
cellIndex
- Cell indexcontent
- Cell contenttype
- Cell typestyleName
- Cell style namefield
- Field- Returns:
- Cell
-
getStringCellStyle
public org.apache.poi.ss.usermodel.CellStyle getStringCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get string cell style- Parameters:
bgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getStringCellStyle
public org.apache.poi.ss.usermodel.CellStyle getStringCellStyle(short bgcolor, boolean head)
Get string cell style- Parameters:
bgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getNumericCellStyle
public static org.apache.poi.ss.usermodel.CellStyle getNumericCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get numeric cell style- Parameters:
wb
- Workbookbgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getNumericCellStyle
public static org.apache.poi.ss.usermodel.CellStyle getNumericCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head, int precision, java.lang.String currency)
Get string cell style- Parameters:
wb
- Workbookbgcolor
- Background colorhead
- Head?precision
- Precisioncurrency
- Currency- Returns:
- Cell style
-
getNumericCellStyle
public org.apache.poi.ss.usermodel.CellStyle getNumericCellStyle(short bgcolor, boolean head)
Get string cell style- Parameters:
bgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getDateCellStyle
public static org.apache.poi.ss.usermodel.CellStyle getDateCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get date cell style- Parameters:
wb
- Workbookbgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getDateCellStyle
public org.apache.poi.ss.usermodel.CellStyle getDateCellStyle(short bgcolor, boolean head)
Get date cell style- Parameters:
bgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getDateTimeCellStyle
public static org.apache.poi.ss.usermodel.CellStyle getDateTimeCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get date and time cell style- Parameters:
wb
- Workbookbgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getDateTimeCellStyle
public org.apache.poi.ss.usermodel.CellStyle getDateTimeCellStyle(short bgcolor, boolean head)
Get date and time cell style- Parameters:
bgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getFormulaCellStyle
public org.apache.poi.ss.usermodel.CellStyle getFormulaCellStyle(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
Get formula cell style- Parameters:
wb
- Workbookbgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getFormulaCellStyle
public org.apache.poi.ss.usermodel.CellStyle getFormulaCellStyle(short bgcolor, boolean head)
Get date cell style- Parameters:
bgcolor
- Background colorhead
- Head?- Returns:
- Cell style
-
getWorkbook
public org.apache.poi.ss.usermodel.Workbook getWorkbook()
Get workbook- Returns:
- POI workbook
-
getStyles
public java.util.Map<java.lang.String,org.apache.poi.ss.usermodel.CellStyle> getStyles()
Get custom styles- Returns:
- Styles map
-
loadStyles
public java.util.Map<java.lang.String,org.apache.poi.ss.usermodel.CellStyle> loadStyles()
-
getSheet
public org.apache.poi.ss.usermodel.Sheet getSheet(java.lang.String label)
Get Sheet by label- Parameters:
label
- Sheet label- Returns:
- Sheet or null
-
addSheet
public org.apache.poi.ss.usermodel.Sheet addSheet(java.lang.String label)
Add a sheet to workbook- Parameters:
label
- Sheet label- Returns:
- POI sheet
-
addSheet
public org.apache.poi.ss.usermodel.Sheet addSheet(java.lang.String label, int defaultRowHeight, int defaultCellWidth)
Add a sheet to workbook- Parameters:
label
- Sheet labeldefaultRowHeight
- default row heightdefaultCellWidth
- default cell width- Returns:
- POI sheet
-
adjustSheet
public void adjustSheet(org.apache.poi.ss.usermodel.Sheet sheet, int autoSizeColumns, int freezeRows)
Adjust sheet sizing. To be called when sheet is completed.- Parameters:
autoSizeColumns
- Number of columns to resizefreezeRows
- Number of top rows to freeze
-
addRow
public org.apache.poi.ss.usermodel.Row addRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex)
Add an empty row to the sheet- Parameters:
sheet
- Current sheetrowIndex
- Row index to add- Returns:
- Row
-
addRow
public org.apache.poi.ss.usermodel.Row addRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex, ExcelTool.ExcelCell cell)
Add a row to the sheet- Parameters:
sheet
- Current sheetrowIndex
- Row index to addcell
- One cell with Simplicite properties- Returns:
- Row
-
addRow
public org.apache.poi.ss.usermodel.Row addRow(org.apache.poi.ss.usermodel.Sheet sheet, ExcelTool.ExcelRow row)
Add a row to the sheet- Parameters:
sheet
- Current sheetrow
- Arrays of cells with Simplicite properties- Returns:
- Row
-
addJPEGPicture
public void addJPEGPicture(byte[] data, org.apache.poi.ss.usermodel.Sheet sheet, int row, int col)
Add JPEG picture- Parameters:
data
- Picture datasheet
- Sheetrow
- Rowcol
- Column
-
addPNGPicture
public void addPNGPicture(byte[] data, org.apache.poi.ss.usermodel.Sheet sheet, int row, int col)
Add PNG picture- Parameters:
data
- Picture datasheet
- Sheetrow
- Rowcol
- Column
-
generateToByteArray
public byte[] generateToByteArray() throws java.io.IOException
Generate workbook as byte array- Returns:
- Byte array
- Throws:
java.io.IOException
- If generation fails
-
generateToFile
public void generateToFile(java.lang.String fileName) throws java.io.IOException
Generate workbook to file- Parameters:
fileName
- File name- Throws:
java.io.IOException
- If generation fails
-
generate
public void generate(java.io.OutputStream out) throws java.io.IOException
Generate workbook to specified output stream- Parameters:
out
- Output stream- Throws:
java.io.IOException
- If generation fails
-
updateFormulas
public void updateFormulas(org.apache.poi.ss.usermodel.Sheet sheet)
Update formulas in sheet- Parameters:
sheet
- Sheet
-
export
@Deprecated(forRemoval=true, since="4.0") public void export(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, java.lang.String format, java.io.OutputStream out)
Deprecated, for removal: This API element is subject to removal in a future version.Export object list as Excel workbook- Parameters:
obj
- Objectrows
- Data rows to export (use paginate searches if null)mode
- Full or panel modeformat
- Excel format (binary)out
- Output stream
-
export
public java.lang.String export(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, java.io.OutputStream out)
Export object list as Excel workbook- Parameters:
obj
- Objectrows
- Data rows to export (use paginate searches if null)mode
- Full or panel modeout
- Optional Output stream- Returns:
- temporary file name to export data when out is null
-
export
@Deprecated(forRemoval=true, since="4.0") public void export(ObjectDB obj, java.lang.String mode, java.lang.String format, java.io.OutputStream out)
Deprecated, for removal: This API element is subject to removal in a future version.Export object form as Excel workbook- Parameters:
obj
- Objectmode
- Full or panel modeformat
- Excel format (binary)out
- Output stream
-
export
public void export(ObjectDB obj, java.lang.String mode, java.io.OutputStream out)
Export object form as Excel workbook- Parameters:
obj
- Objectmode
- Full or panel modeout
- Output stream
-
toHTML
@Deprecated(forRemoval=true, since="4.0") public void toHTML(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, java.io.PrintWriter out)
Deprecated, for removal: This API element is subject to removal in a future version.Export object list as HTML table- Parameters:
obj
- Objectrows
- Data rows (pagination if null)mode
- Full or panel modeout
- output stream
-
addRow
public void addRow(ObjectDB obj, java.util.List<ObjectField> fields, java.lang.String[] row, java.io.PrintWriter out)
Add a record to HTML output- Parameters:
obj
- Objectfields
- Fields to exportrow
- Dataout
- Output writer
-
toHTML
@Deprecated(forRemoval=true, since="4.0") public void toHTML(ObjectDB obj, java.lang.String mode, java.io.PrintWriter out)
Deprecated, for removal: This API element is subject to removal in a future version.Export object form as Excel workbook (HTML table format)- Parameters:
obj
- Objectmode
- Full or panel modeout
- output writer
-
addRows
public void addRows(ObjectDB obj, java.util.List<ObjectField> fields, java.util.List<java.lang.String[]> rows)
Add a rows to Excel POI- Parameters:
obj
- Objectfields
- Fields to exportrows
- Records or paginated search if null
-
addRows
public void addRows(ObjectDB obj, java.util.List<ObjectField> fields, java.util.List<java.lang.String[]> rows, Link link)
Add a rows to Excel POI- Parameters:
obj
- Objectfields
- Fields to exportrows
- Records or paginated search if nulllink
- Optional link
-
toPOI
public java.lang.String toPOI(ObjectDB obj, java.util.List<java.lang.String[]> rows, java.lang.String mode, java.io.OutputStream out) throws java.lang.Exception
Export object list as Excel workbook (binary format)- Parameters:
obj
- Objectrows
- Data rows (pagination if null)mode
- Full or panel modeout
- optional output-stream- Returns:
- null or tmp file name if out is null
- Throws:
java.lang.Exception
-
toPOI
public void toPOI(ObjectDB obj, java.lang.String mode, java.io.OutputStream out)
Export object form as Excel workbook (binary format)
- Parameters:
obj
- Objectmode
- Full or panel modeout
- Output stream
-
-