Package com.jk.core.util
Class JKExcelUtil
java.lang.Object
com.jk.core.util.JKExcelUtil
This class is a utility class used for creating and writing Excel sheets
 using Apache POI.
- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 
- 
Constructor Summary
ConstructorsConstructorDescriptionJKExcelUtil(JKTableModel model) This method constructs a newJKExcelUtilfrom the data available in theJKTableModel. - 
Method Summary
Modifier and TypeMethodDescriptionstatic voidbuildExcelSheet(JKTableModel model) This method builds an Excel sheet using the providedJKTableModeland displays it.protected voidThis method creates the column headers in the work sheet.protected voidcreateRow(int rowIndex) This method inserts a new row at the specified index in the work sheet.protected voidThis method creates all the rows specified in theJKTableModel.protected voidThis method sets the width of columns to auto-fit its content.voidThis method writes the Excel sheet to the specified file.voidwriteTo(OutputStream out) This method writes the Excel sheet to the specified output stream. 
- 
Constructor Details
- 
JKExcelUtil
This method constructs a newJKExcelUtilfrom the data available in theJKTableModel.- Parameters:
 model- Specifies theJKTableModelrepresenting the data to be written to the sheet.
 
 - 
 - 
Method Details
- 
buildExcelSheet
This method builds an Excel sheet using the providedJKTableModeland displays it.- Parameters:
 model- Specifies theJKTableModelrepresenting the data to be written to the sheet.
 - 
createColumnHeaders
protected void createColumnHeaders()This method creates the column headers in the work sheet. - 
createRow
protected void createRow(int rowIndex) This method inserts a new row at the specified index in the work sheet.- Parameters:
 rowIndex- Specifies the row index that the new row will be inserted in.
 - 
createRows
protected void createRows()This method creates all the rows specified in theJKTableModel. - 
setColumnsWidth
protected void setColumnsWidth()This method sets the width of columns to auto-fit its content. - 
writeTo
This method writes the Excel sheet to the specified file.- Parameters:
 file- Specifies the file to write the Excel sheet to.- Throws:
 IOException- if an I/O exception has occurred.
 - 
writeTo
This method writes the Excel sheet to the specified output stream.- Parameters:
 out- Specifies the output stream to write the Excel sheet to.- Throws:
 IOException- if an I/O exception has occurred.
 
 -