Package csv.util
Class WorkbookCellStyles
java.lang.Object
csv.util.WorkbookCellStyles
Help with the styles in a workbook.
Use this helper when u need different styles in a workbook and refer to them by name.
- Author:
- ralph
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWorkbookCellStyles(org.apache.poi.ss.usermodel.Workbook workbook) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.poi.ss.usermodel.CellStylecreateStyle(String name) Creates a style of the given name.org.apache.poi.ss.usermodel.FontReturns the default bold font.org.apache.poi.ss.usermodel.DataFormatReturns the data format object of the workbook.org.apache.poi.ss.usermodel.FontReturns the default bold font.org.apache.poi.ss.usermodel.CellStyleReturns the cached cell style of the given name.org.apache.poi.ss.usermodel.WorkbookReturns the workbook.org.apache.poi.ss.usermodel.CellStyleSet the style in the given cell according to the cell style name.org.apache.poi.ss.usermodel.CellStyleSet the style in the given row cell according to the cell style name.org.apache.poi.ss.usermodel.CellStyleSet the style in the given sheet cell according to the ceel style name.
-
Constructor Details
-
WorkbookCellStyles
public WorkbookCellStyles(org.apache.poi.ss.usermodel.Workbook workbook) Constructor.- Parameters:
workbook- - the workbook this helper is attached to.
-
-
Method Details
-
getStyle
Returns the cached cell style of the given name.The method will call
createStyle(String)when the style was not created yet.invalid input: '<'/- Parameters:
name- - name of the style.- Returns:
- the style of the given name or
nullif it cannot be found or created. - See Also:
-
setStyle
public org.apache.poi.ss.usermodel.CellStyle setStyle(org.apache.poi.ss.usermodel.Sheet sheet, int row, int col, String name) Set the style in the given sheet cell according to the ceel style name.- Parameters:
sheet- - sheet that the cell belongs torow- - row index of cellcol- - column index of cellname- - name of style to be set- Returns:
- the cell style that was applied.
- See Also:
-
setStyle
public org.apache.poi.ss.usermodel.CellStyle setStyle(org.apache.poi.ss.usermodel.Row row, int col, String name) Set the style in the given row cell according to the cell style name.- Parameters:
row- - row the cell belongs tocol- - column index of cellname- - name of style to be set- Returns:
- the cell style that was applied.
- See Also:
-
setStyle
public org.apache.poi.ss.usermodel.CellStyle setStyle(org.apache.poi.ss.usermodel.Cell cell, String name) Set the style in the given cell according to the cell style name.- Parameters:
cell- - the sell to be modifiedname- - name of style to be set- Returns:
- the cell style that was applied.
-
createStyle
Creates a style of the given name.Descendants must override this method to create the cell style for their specific usage.
- Parameters:
name- - name of the cell style to be created- Returns:
- the cell style of the given name or
null - See Also:
-
getWorkbook
public org.apache.poi.ss.usermodel.Workbook getWorkbook()Returns the workbook.- Returns:
- the workbook.
-
getBoldFont
public org.apache.poi.ss.usermodel.Font getBoldFont()Returns the default bold font.- Returns:
- bold font
- See Also:
-
getPlainFont
public org.apache.poi.ss.usermodel.Font getPlainFont()Returns the default bold font.- Returns:
- bold font
- See Also:
-
getDataFormat
public org.apache.poi.ss.usermodel.DataFormat getDataFormat()Returns the data format object of the workbook.- Returns:
- the data format object of the workbook.
-