Package org.zkoss.pivot.util.poi
Class StyleFactory
- java.lang.Object
-
- org.zkoss.pivot.util.poi.StyleFactory
-
public class StyleFactory extends Object
- Author:
- Sam
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStyleFactory.FontProperty
-
Field Summary
Fields Modifier and Type Field Description static shortDEFAULT_BOLD_WEIGHTstatic shortDEFAULT_COLORstatic shortDEFAULT_FONT_HEIGHT_IN_POINTSstatic StringDEFAULT_FONT_NAMEstatic booleanDEFAULT_ITALICstatic booleanDEFAULT_STRIKEOUTstatic shortDEFAULT_TYPE_OFFSETstatic byteDEFAULT_UNDERLINE
-
Constructor Summary
Constructors Constructor Description StyleFactory(org.zkoss.poi.ss.usermodel.Workbook book)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.zkoss.poi.ss.usermodel.CellStylecloneCellStyle(org.zkoss.poi.ss.usermodel.CellStyle source)Create a new Cell style, and clones from source CellStyleorg.zkoss.poi.ss.usermodel.CellStylecreateCellStyle()Create a new Cell styleorg.zkoss.poi.ss.usermodel.CellStylecreateCellStyle(String dataFormat)Create a new Cell style with data format.shortcreateDataFormat(String format)Creates a new DataFormat instanceorg.zkoss.poi.ss.usermodel.FontcreateFont()Create a new Font.org.zkoss.poi.ss.usermodel.FontgetOrCreateFont(short boldWeight, short color, short fontHeightInPoints, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)Finds a font that matches the one with the supplied attributes.org.zkoss.poi.ss.usermodel.FontgetOrCreateFont(Map<StyleFactory.FontProperty,Object> properties)Finds a font that matches the one with the supplied attributes.org.zkoss.poi.ss.usermodel.FontgetOrCreateFontWithBoldWeight(short fontBoldWeight)Find font with bold attribute, if font not found, create a new Font with bold attributeorg.zkoss.poi.ss.usermodel.FontgetOrCreateFontWithColor(short fontColor)Find font with color attribute, if not found, create a new Font with color attribute.org.zkoss.poi.ss.usermodel.FontgetOrCreateFontWithHeight(short fontHeightInPoints)Find font with height attribute (in points), if not found, create a new Font with height attribute.org.zkoss.poi.ss.usermodel.FontgetOrCreateFontWithItalic(boolean italic)Find font with italic attribute, if not found, create a new Font with italic attribute.org.zkoss.poi.ss.usermodel.FontgetOrCreateFontWithName(String fontName)Find font with font name, if not found, create a new Font with font name.org.zkoss.poi.ss.usermodel.FontgetOrCreateFontWithStrikeout(boolean Strikeout)Find font with strikeout attribute, if not found, create a new Font with strikeout attribute.org.zkoss.poi.ss.usermodel.FontgetOrCreateFontWithTypeOffset(short typeOffset)Find font with TypeOffset attribute, if not found, create a new Font with TypeOffset attribute.org.zkoss.poi.ss.usermodel.FontgetOrCreateFontWithUnderline(byte underline)Find font with underline attribute, if not found, create a new Font with underline attribute.
-
-
-
Field Detail
-
DEFAULT_BOLD_WEIGHT
public static final short DEFAULT_BOLD_WEIGHT
- See Also:
- Constant Field Values
-
DEFAULT_COLOR
public static final short DEFAULT_COLOR
- See Also:
- Constant Field Values
-
DEFAULT_FONT_HEIGHT_IN_POINTS
public static final short DEFAULT_FONT_HEIGHT_IN_POINTS
- See Also:
- Constant Field Values
-
DEFAULT_FONT_NAME
public static final String DEFAULT_FONT_NAME
- See Also:
- Constant Field Values
-
DEFAULT_ITALIC
public static final boolean DEFAULT_ITALIC
- See Also:
- Constant Field Values
-
DEFAULT_STRIKEOUT
public static final boolean DEFAULT_STRIKEOUT
- See Also:
- Constant Field Values
-
DEFAULT_TYPE_OFFSET
public static final short DEFAULT_TYPE_OFFSET
- See Also:
- Constant Field Values
-
DEFAULT_UNDERLINE
public static final byte DEFAULT_UNDERLINE
- See Also:
- Constant Field Values
-
-
Method Detail
-
createCellStyle
public org.zkoss.poi.ss.usermodel.CellStyle createCellStyle()
Create a new Cell style
-
cloneCellStyle
public org.zkoss.poi.ss.usermodel.CellStyle cloneCellStyle(org.zkoss.poi.ss.usermodel.CellStyle source)
Create a new Cell style, and clones from source CellStyle
-
createCellStyle
public org.zkoss.poi.ss.usermodel.CellStyle createCellStyle(String dataFormat)
Create a new Cell style with data format.- Parameters:
dataFormat-
-
createDataFormat
public short createDataFormat(String format)
Creates a new DataFormat instance
-
getOrCreateFont
public org.zkoss.poi.ss.usermodel.Font getOrCreateFont(Map<StyleFactory.FontProperty,Object> properties)
Finds a font that matches the one with the supplied attributes. If no match, create a new Font with the supplied attributes.
-
getOrCreateFontWithBoldWeight
public org.zkoss.poi.ss.usermodel.Font getOrCreateFontWithBoldWeight(short fontBoldWeight)
Find font with bold attribute, if font not found, create a new Font with bold attribute
-
getOrCreateFontWithColor
public org.zkoss.poi.ss.usermodel.Font getOrCreateFontWithColor(short fontColor)
Find font with color attribute, if not found, create a new Font with color attribute.
-
getOrCreateFontWithHeight
public org.zkoss.poi.ss.usermodel.Font getOrCreateFontWithHeight(short fontHeightInPoints)
Find font with height attribute (in points), if not found, create a new Font with height attribute.
-
getOrCreateFontWithName
public org.zkoss.poi.ss.usermodel.Font getOrCreateFontWithName(String fontName)
Find font with font name, if not found, create a new Font with font name.
-
getOrCreateFontWithItalic
public org.zkoss.poi.ss.usermodel.Font getOrCreateFontWithItalic(boolean italic)
Find font with italic attribute, if not found, create a new Font with italic attribute.
-
getOrCreateFontWithStrikeout
public org.zkoss.poi.ss.usermodel.Font getOrCreateFontWithStrikeout(boolean Strikeout)
Find font with strikeout attribute, if not found, create a new Font with strikeout attribute.
-
getOrCreateFontWithTypeOffset
public org.zkoss.poi.ss.usermodel.Font getOrCreateFontWithTypeOffset(short typeOffset)
Find font with TypeOffset attribute, if not found, create a new Font with TypeOffset attribute.
-
getOrCreateFontWithUnderline
public org.zkoss.poi.ss.usermodel.Font getOrCreateFontWithUnderline(byte underline)
Find font with underline attribute, if not found, create a new Font with underline attribute.
-
getOrCreateFont
public org.zkoss.poi.ss.usermodel.Font getOrCreateFont(short boldWeight, short color, short fontHeightInPoints, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)Finds a font that matches the one with the supplied attributes. If no match, create a new Font with the supplied attributes.
-
createFont
public org.zkoss.poi.ss.usermodel.Font createFont()
Create a new Font.
-
-