Class 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 attributes
      static class  ExcelTool.ExcelRow
      Row with cells
    • Constructor Summary

      Constructors 
      Constructor Description
      ExcelTool()
      Empty constructor
      ExcelTool​(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 picture
      void addPNGPicture​(byte[] data, org.apache.poi.ss.usermodel.Sheet sheet, int row, int col)
      Add PNG picture
      void addRow​(ObjectDB obj, java.util.List<ObjectField> fields, java.lang.String[] row, java.io.PrintWriter out)
      Add a record to HTML output
      org.apache.poi.ss.usermodel.Row addRow​(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex)
      Add an empty row to the sheet
      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
      org.apache.poi.ss.usermodel.Row addRow​(org.apache.poi.ss.usermodel.Sheet sheet, ExcelTool.ExcelRow row)
      Add a row to the sheet
      void addRows​(ObjectDB obj, java.util.List<ObjectField> fields, java.util.List<java.lang.String[]> rows)
      Add a rows to Excel POI
      void addRows​(ObjectDB obj, java.util.List<ObjectField> fields, java.util.List<java.lang.String[]> rows, Link link)
      Add a rows to Excel POI
      org.apache.poi.ss.usermodel.Sheet addSheet​(java.lang.String label)
      Add a sheet to workbook
      org.apache.poi.ss.usermodel.Sheet addSheet​(java.lang.String label, int defaultRowHeight, int defaultCellWidth)
      Add a sheet to workbook
      void 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 workbook
      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. 
      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
      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. 
      void generate​(java.io.OutputStream out)
      Generate workbook to specified output stream
      byte[] generateToByteArray()
      Generate workbook as byte array
      void generateToFile​(java.lang.String fileName)
      Generate workbook to file
      org.apache.poi.ss.usermodel.CellStyle getDateCellStyle​(short bgcolor, boolean head)
      Get date cell style
      static org.apache.poi.ss.usermodel.CellStyle getDateCellStyle​(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
      Get date cell style
      org.apache.poi.ss.usermodel.CellStyle getDateTimeCellStyle​(short bgcolor, boolean head)
      Get date and time cell style
      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
      org.apache.poi.ss.usermodel.CellStyle getFormulaCellStyle​(short bgcolor, boolean head)
      Get date cell style
      org.apache.poi.ss.usermodel.CellStyle getFormulaCellStyle​(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
      Get formula cell style
      org.apache.poi.ss.usermodel.CellStyle getNumericCellStyle​(short bgcolor, boolean head)
      Get string cell style
      static org.apache.poi.ss.usermodel.CellStyle getNumericCellStyle​(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
      Get numeric cell style
      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
      org.apache.poi.ss.usermodel.Sheet getSheet​(java.lang.String label)
      Get Sheet by label
      org.apache.poi.ss.usermodel.CellStyle getStringCellStyle​(short bgcolor, boolean head)
      Get string cell style
      org.apache.poi.ss.usermodel.CellStyle getStringCellStyle​(org.apache.poi.ss.usermodel.Workbook wb, short bgcolor, boolean head)
      Get string cell style
      java.util.Map<java.lang.String,​org.apache.poi.ss.usermodel.CellStyle> getStyles()
      Get custom styles
      org.apache.poi.ss.usermodel.Workbook getWorkbook()
      Get workbook
      java.util.Map<java.lang.String,​org.apache.poi.ss.usermodel.CellStyle> loadStyles()  
      ExcelTool.ExcelCell newCell​(int cellIndex, double value)
      Get new cell
      ExcelTool.ExcelCell newCell​(int cellIndex, float value)
      Get new cell
      ExcelTool.ExcelCell newCell​(int cellIndex, int value)
      Get new cell
      ExcelTool.ExcelCell newCell​(int cellIndex, ObjectField field, java.lang.String value)
      Get new cell
      ExcelTool.ExcelCell newCell​(int cellIndex, java.lang.String content)
      Get new cell
      ExcelTool.ExcelCell newCell​(int cellIndex, java.lang.String content, org.apache.poi.ss.usermodel.CellType type)
      Get new cell
      ExcelTool.ExcelCell newCell​(int cellIndex, java.lang.String content, org.apache.poi.ss.usermodel.CellType type, java.lang.String styleName)
      Get new cell
      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
      ExcelTool.ExcelCell newCell​(int cellIndex, java.util.Date date, boolean withTime)
      Get new cell for a date
      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. 
      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
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 data
        openxml - 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 - Grant
        doc - 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 stream
        openxml - 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 stream
        rowsAccess - 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 index
        field - Field
        value - value
      • newCell

        public ExcelTool.ExcelCell newCell​(int cellIndex,
                                           java.lang.String content)
        Get new cell
        Parameters:
        cellIndex - Cell index
        content - Cell content
        Returns:
        Cell
      • newCell

        public ExcelTool.ExcelCell newCell​(int cellIndex,
                                           int value)
        Get new cell
        Parameters:
        cellIndex - Cell index
        value - Cell integer content
        Returns:
        Cell
      • newCell

        public ExcelTool.ExcelCell newCell​(int cellIndex,
                                           float value)
        Get new cell
        Parameters:
        cellIndex - Cell index
        value - Cell float content
        Returns:
        Cell
      • newCell

        public ExcelTool.ExcelCell newCell​(int cellIndex,
                                           double value)
        Get new cell
        Parameters:
        cellIndex - Cell index
        value - 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 index
        date - Date
        withTime - 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 index
        content - Cell content
        type - 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 index
        content - Cell content
        type - Cell type
        styleName - 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 index
        content - Cell content
        type - Cell type
        styleName - Cell style name
        field - 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 color
        head - Head?
        Returns:
        Cell style
      • getStringCellStyle

        public org.apache.poi.ss.usermodel.CellStyle getStringCellStyle​(short bgcolor,
                                                                        boolean head)
        Get string cell style
        Parameters:
        bgcolor - Background color
        head - 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 - Workbook
        bgcolor - Background color
        head - 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 - Workbook
        bgcolor - Background color
        head - Head?
        precision - Precision
        currency - Currency
        Returns:
        Cell style
      • getNumericCellStyle

        public org.apache.poi.ss.usermodel.CellStyle getNumericCellStyle​(short bgcolor,
                                                                         boolean head)
        Get string cell style
        Parameters:
        bgcolor - Background color
        head - 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 - Workbook
        bgcolor - Background color
        head - Head?
        Returns:
        Cell style
      • getDateCellStyle

        public org.apache.poi.ss.usermodel.CellStyle getDateCellStyle​(short bgcolor,
                                                                      boolean head)
        Get date cell style
        Parameters:
        bgcolor - Background color
        head - 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 - Workbook
        bgcolor - Background color
        head - 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 color
        head - 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 - Workbook
        bgcolor - Background color
        head - Head?
        Returns:
        Cell style
      • getFormulaCellStyle

        public org.apache.poi.ss.usermodel.CellStyle getFormulaCellStyle​(short bgcolor,
                                                                         boolean head)
        Get date cell style
        Parameters:
        bgcolor - Background color
        head - 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 label
        defaultRowHeight - default row height
        defaultCellWidth - 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 resize
        freezeRows - 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 sheet
        rowIndex - 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 sheet
        rowIndex - Row index to add
        cell - 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 sheet
        row - 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 data
        sheet - Sheet
        row - Row
        col - Column
      • addPNGPicture

        public void addPNGPicture​(byte[] data,
                                  org.apache.poi.ss.usermodel.Sheet sheet,
                                  int row,
                                  int col)
        Add PNG picture
        Parameters:
        data - Picture data
        sheet - Sheet
        row - Row
        col - 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 - Object
        rows - Data rows to export (use paginate searches if null)
        mode - Full or panel mode
        format - 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 - Object
        rows - Data rows to export (use paginate searches if null)
        mode - Full or panel mode
        out - 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 - Object
        mode - Full or panel mode
        format - 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 - Object
        mode - Full or panel mode
        out - 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 - Object
        rows - Data rows (pagination if null)
        mode - Full or panel mode
        out - 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 - Object
        fields - Fields to export
        row - Data
        out - 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 - Object
        mode - Full or panel mode
        out - 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 - Object
        fields - Fields to export
        rows - 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 - Object
        fields - Fields to export
        rows - Records or paginated search if null
        link - 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 - Object
        rows - Data rows (pagination if null)
        mode - Full or panel mode
        out - optional output-stream
        Returns:
        null or tmp file name to wait for
        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 - Object
        mode - Full or panel mode
        out - Output stream