Package org.openxava.util.jxls
Class JxlsStyle
java.lang.Object
org.openxava.util.jxls.JxlsStyle
- All Implemented Interfaces:
JxlsConstants
JxlsStyle: a class to wrap and simplify the use of Apache POI CellStyle in the context of OpenXava
Principle:
JxlsStyle should not be instantiated directly, but rather created through workbook.addStyle(style)
each setProperty returns the style so the setProperty's can be chained
Usage:
JxlsWorkbook wb = new JxlsWorkbook("Test");
JxlsSheet sheet = wb.addSheet("Test");
JxlsStyle boldCenteredTextS = wb.addStyle(TEXT).setAlign(CENTER).setBold();
JxlsStyle boldCenteredTextBorderedS = wb.addClonedStyle(boldCenteredTextS).setBorder(BOTTOM, BORDER_THIN);
sheet.setValue(3, 4, "Pi", boldCenteredTextS);
sheet.setValue(4, 4, "Pi", boldCenteredTextBorderedS);
- Author:
- Laurent Wibaux
-
Field Summary
FieldsFields inherited from interface org.openxava.util.jxls.JxlsConstants
ALL, AUTO_SIZE, BLACK, BLUE, BOLD, BORDER_NONE, BORDER_THICK, BORDER_THIN, BOTTOM, CENTER, DATE, EMPTY, FLOAT, GREEN, INTEGER, LEFT, LEFT_RIGHT, LIGHT_GREEN, LIGHT_GREY, LIGHT_YELLOW, NONE, PLAIN, RED, RIGHT, TEXT, TOP, TOP_BOTTOM, WHITE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJxlsStyle(JxlsWorkbook workbook, String name, int type) protectedJxlsStyle(JxlsWorkbook workbook, String name, String format) -
Method Summary
Modifier and TypeMethodDescriptionprotected JxlsStyleclone(JxlsWorkbook workbook, String name) protected voidcreatePOICellStyle(JxlsWorkbook workbook, org.apache.poi.ss.usermodel.Workbook poiWorkbook) setAlign(short align) Sets the justification to use to render the content of the cellsetBold()Make the cell using this style boldsetBold(boolean isBold) Make the cell using this style bold or notsetBorder(short place, short borderStyle) Sets the borders for some of the sides of the cellsetBorderColor(short borderColor) Sets the border color for the 4 sides of the cellsetBorders(short top, short bottom, short left, short right) Sets the borders for the 4 sides of the cellsetCellColor(short bgColor) Sets the color to use to render the background of the cellsetFontName(String fontName) Sets the font name to use in this stylesetFontSize(int fontSize) Sets the font size to use in this styleSets the format to use to display numbers using this stylesetTextColor(short textColor) Sets the color to use to render the writing of the cellsetWrap(boolean wraps) Make the cell wraps its content
-
Field Details
-
cellStyle
protected org.apache.poi.ss.usermodel.CellStyle cellStyle
-
-
Constructor Details
-
JxlsStyle
-
JxlsStyle
-
-
Method Details
-
clone
-
setFontName
Sets the font name to use in this style- Parameters:
fontName- the name of the font- Returns:
- the style to chain other settings
-
setFontSize
Sets the font size to use in this style- Parameters:
fontSize- the size in points of the font- Returns:
- the style to chain other settings
-
setFormat
Sets the format to use to display numbers using this style- Parameters:
format- the format encoded as per xls- Returns:
- the style to chain other settings
-
setBold
Make the cell using this style bold- Returns:
- the style to chain other settings
-
setWrap
Make the cell wraps its content- Returns:
- the style to chain other settings
-
setBold
Make the cell using this style bold or not- Parameters:
isBold- true to set bold, false otherwise- Returns:
- the style to chain other settings
-
setTextColor
Sets the color to use to render the writing of the cell- Parameters:
textColor- the color (one of JxlsConstants color, or one of HSSFColor.color.index)- Returns:
- the style to chain other settings
-
setCellColor
Sets the color to use to render the background of the cell- Parameters:
bgColor- the color (one of JxlsConstants color, or one of HSSFColor.?.index)- Returns:
- the style to chain other settings
-
setAlign
Sets the justification to use to render the content of the cell- Parameters:
align- the alignment (one of LEFT, CENTER, RIGHT)- Returns:
- the style to chain other settings
-
setBorders
Sets the borders for the 4 sides of the cell- Parameters:
top- the border to use at the top (one of BORDER_NONE, BORDER_THIN, BORDER_THICK or CellStyle.BORDER_?)bottom- the border to use at the bottomleft- the border to use at the leftright- the border to use at the right- Returns:
- the style to chain other settings
-
setBorder
Sets the borders for some of the sides of the cell- Parameters:
place- the borders to sets (TOP, TOP+LEFT, TOP+BOTTOM...)borderStyle- the border style to use (one of BORDER_NONE, BORDER_THIN, BORDER_THICK or CellStyle.BORDER_?)- Returns:
- the style to chain other settings
-
setBorderColor
Sets the border color for the 4 sides of the cell- Parameters:
borderColor- the color (one of JxlsConstants color, or one of HSSFColor.color.index)- Returns:
- the style to chain other settings
-
createPOICellStyle
protected void createPOICellStyle(JxlsWorkbook workbook, org.apache.poi.ss.usermodel.Workbook poiWorkbook)
-