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
ConstructorDescriptionExcelExport
(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 theExportable
interface.- 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. TheHSSFWorkbook
orSXSSFWorkbook
instances are created, depending on whetherExportTypes.XLS
orExportTypes.XLSX
is included in the params. Headers and cell formatting are all specified here.- Specified by:
start
in classDataExporter
- Returns:
- Successful creation of
HSSFWorkbook
orSXSSFWorkbook
-
process
Writes records into aWorkbook
object. Cells are formatted according to the data stored in them.- Specified by:
process
in 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
HSSFWorkbook
applies, a maximum of 65,535 rows can be written into the file. If this maximum number has been reached, the method returnsfalse
and 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:
end
in classDataExporter
- Returns:
- Export successful
- Throws:
IOException
- An exception is thrown while handling a source
-