Package com.jbstrap.core.data.export
Class ExcelExport
java.lang.Object
com.jbstrap.core.data.DataExporter
com.jbstrap.core.data.export.ExcelExport
Class for exporting data into Excel format (xls, xlsx)
- Since:
- 4.0
- Author:
- JBStrap
-
Field Summary
Fields inherited from class com.jbstrap.core.data.DataExporter
columnMap, params -
Constructor Summary
ConstructorsConstructorDescriptionExcelExport(Parameters params) Creates an ExcelExport instance with the specified export settings (parameters). -
Method Summary
Methods inherited from class com.jbstrap.core.data.DataExporter
addColumnMapping, addColumnMapping, getColumnMapping, getExtension, removeColumnMapping
-
Constructor Details
-
ExcelExport
Creates an ExcelExport instance with the specified export settings (parameters). Parameters are described in theExportableinterface.- Parameters:
params- Additional ExcelExport parametersParameter name Parameter value Default parameter value Parameter description sheetName String export.defaultSheetName message source, by default: Exported data Excel worksheet name
-
-
Method Details
-
start
public boolean start()Starts an Excel export. TheHSSFWorkbookorSXSSFWorkbookinstances are created, depending on whetherExportTypes.XLSorExportTypes.XLSXis included in the params. Headers and cell formatting are all specified here.- Specified by:
startin classDataExporter- Returns:
- Successful creation of
HSSFWorkbookorSXSSFWorkbook
-
process
Writes records into aWorkbookobject. Cells are formatted according to the data stored in them.- Specified by:
processin classDataExporter- Parameters:
data- Records retrieved using lazy fetch- Returns:
- Successful processing of records or no more rows can be written into the Excel file. If
HSSFWorkbookapplies, a maximum of 65,535 rows can be written into the file. If this maximum number has been reached, the method returnsfalseand the end() method comes next.
-
end
Export completed, no more records to be processed. Closes the created sources and returns them in a byte array.- Specified by:
endin classDataExporter- Returns:
- Export successful
- Throws:
IOException- An exception is thrown while handling a source
-