Save This Page
Home » poi-src-3.2-FINAL-20081019 » org.apache » poi » hssf » usermodel » [javadoc | source]
org.apache.poi.hssf.usermodel
public class: HSSFCellStyle [javadoc | source]
java.lang.Object
   org.apache.poi.hssf.usermodel.HSSFCellStyle
High level representation of the style of a cell in a sheet of a workbook.
Field Summary
public static final  short ALIGN_GENERAL    general (normal) horizontal alignment 
public static final  short ALIGN_LEFT    left-justified horizontal alignment 
public static final  short ALIGN_CENTER    center horizontal alignment 
public static final  short ALIGN_RIGHT    right-justified horizontal alignment 
public static final  short ALIGN_FILL    fill? horizontal alignment 
public static final  short ALIGN_JUSTIFY    justified horizontal alignment 
public static final  short ALIGN_CENTER_SELECTION    center-selection? horizontal alignment 
public static final  short VERTICAL_TOP    top-aligned vertical alignment 
public static final  short VERTICAL_CENTER    center-aligned vertical alignment 
public static final  short VERTICAL_BOTTOM    bottom-aligned vertical alignment 
public static final  short VERTICAL_JUSTIFY    vertically justified vertical alignment 
public static final  short BORDER_NONE    No border 
public static final  short BORDER_THIN    Thin border 
public static final  short BORDER_MEDIUM    Medium border 
public static final  short BORDER_DASHED    dash border 
public static final  short BORDER_HAIR    dot border 
public static final  short BORDER_THICK    Thick border 
public static final  short BORDER_DOUBLE    double-line border 
public static final  short BORDER_DOTTED    hair-line border 
public static final  short BORDER_MEDIUM_DASHED    Medium dashed border 
public static final  short BORDER_DASH_DOT    dash-dot border 
public static final  short BORDER_MEDIUM_DASH_DOT    medium dash-dot border 
public static final  short BORDER_DASH_DOT_DOT    dash-dot-dot border 
public static final  short BORDER_MEDIUM_DASH_DOT_DOT    medium dash-dot-dot border 
public static final  short BORDER_SLANTED_DASH_DOT    slanted dash-dot border 
public static final  short NO_FILL    No background 
public static final  short SOLID_FOREGROUND    Solidly filled 
public static final  short FINE_DOTS    Small fine dots 
public static final  short ALT_BARS    Wide dots 
public static final  short SPARSE_DOTS    Sparse dots 
public static final  short THICK_HORZ_BANDS    Thick horizontal bands 
public static final  short THICK_VERT_BANDS    Thick vertical bands 
public static final  short THICK_BACKWARD_DIAG    Thick backward facing diagonals 
public static final  short THICK_FORWARD_DIAG    Thick forward facing diagonals 
public static final  short BIG_SPOTS    Large spots 
public static final  short BRICKS    Brick-like layout 
public static final  short THIN_HORZ_BANDS    Thin horizontal bands 
public static final  short THIN_VERT_BANDS    Thin vertical bands 
public static final  short THIN_BACKWARD_DIAG    Thin backward diagonal 
public static final  short THIN_FORWARD_DIAG    Thin forward diagonal 
public static final  short SQUARES    Squares 
public static final  short DIAMONDS    Diamonds 
public static final  short LESS_DOTS    Less Dots 
public static final  short LEAST_DOTS    Least Dots 
Constructor:
 protected HSSFCellStyle(short index,
    ExtendedFormatRecord rec,
    HSSFWorkbook workbook) 
    Creates new HSSFCellStyle why would you want to do this??
 protected HSSFCellStyle(short index,
    ExtendedFormatRecord rec,
    Workbook workbook) 
Method from org.apache.poi.hssf.usermodel.HSSFCellStyle Summary:
equals,   getAlignment,   getBorderBottom,   getBorderLeft,   getBorderRight,   getBorderTop,   getBottomBorderColor,   getDataFormat,   getDataFormatString,   getDataFormatString,   getFillBackgroundColor,   getFillForegroundColor,   getFillPattern,   getFont,   getFontIndex,   getHidden,   getIndention,   getIndex,   getLeftBorderColor,   getLocked,   getRightBorderColor,   getRotation,   getTopBorderColor,   getVerticalAlignment,   getWrapText,   hashCode,   setAlignment,   setBorderBottom,   setBorderLeft,   setBorderRight,   setBorderTop,   setBottomBorderColor,   setDataFormat,   setFillBackgroundColor,   setFillForegroundColor,   setFillPattern,   setFont,   setHidden,   setIndention,   setLeftBorderColor,   setLocked,   setRightBorderColor,   setRotation,   setTopBorderColor,   setVerticalAlignment,   setWrapText
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.poi.hssf.usermodel.HSSFCellStyle Detail:
 public boolean equals(Object obj) 
 public short getAlignment() 
    get the type of horizontal alignment for the cell
 public short getBorderBottom() 
    get the type of border to use for the bottom border of the cell
 public short getBorderLeft() 
    get the type of border to use for the left border of the cell
 public short getBorderRight() 
    get the type of border to use for the right border of the cell
 public short getBorderTop() 
    get the type of border to use for the top border of the cell
 public short getBottomBorderColor() 
    get the color to use for the left border
 public short getDataFormat() 
    get the index of the format
 public String getDataFormatString() 
    Get the contents of the format string, by looking up the DataFormat against the bound workbook
 public String getDataFormatString(Workbook workbook) 
    Get the contents of the format string, by looking up the DataFormat against the supplied workbook
 public short getFillBackgroundColor() 
    get the background fill color
 public short getFillForegroundColor() 
    get the foreground fill color
 public short getFillPattern() 
    get the fill pattern (??) - set to 1 to fill with foreground color
 public HSSFFont getFont(HSSFWorkbook parentWorkbook) 
    gets the font for this style
 public short getFontIndex() 
    gets the index of the font for this style
 public boolean getHidden() 
    get whether the cell's using this style are to be hidden
 public short getIndention() 
    get the number of spaces to indent the text in the cell
 public short getIndex() 
    get the index within the HSSFWorkbook (sequence within the collection of ExtnededFormat objects)
 public short getLeftBorderColor() 
    get the color to use for the left border
 public boolean getLocked() 
    get whether the cell's using this style are to be locked
 public short getRightBorderColor() 
    get the color to use for the left border
 public short getRotation() 
    get the degree of rotation for the text in the cell
 public short getTopBorderColor() 
    get the color to use for the top border
 public short getVerticalAlignment() 
    get the type of vertical alignment for the cell
 public boolean getWrapText() 
    get whether the text should be wrapped
 public int hashCode() 
 public  void setAlignment(short align) 
    set the type of horizontal alignment for the cell
 public  void setBorderBottom(short border) 
    set the type of border to use for the bottom border of the cell
 public  void setBorderLeft(short border) 
    set the type of border to use for the left border of the cell
 public  void setBorderRight(short border) 
    set the type of border to use for the right border of the cell
 public  void setBorderTop(short border) 
    set the type of border to use for the top border of the cell
 public  void setBottomBorderColor(short color) 
    set the color to use for the bottom border
 public  void setDataFormat(short fmt) 
    set the data format (must be a valid format)
 public  void setFillBackgroundColor(short bg) 
    set the background fill color.

    For example:

    cs.setFillPattern(HSSFCellStyle.FINE_DOTS );
    cs.setFillBackgroundColor(new HSSFColor.RED().getIndex());
    
    optionally a Foreground and background fill can be applied: Note: Ensure Foreground color is set prior to background
    cs.setFillPattern(HSSFCellStyle.FINE_DOTS );
    cs.setFillForegroundColor(new HSSFColor.BLUE().getIndex());
    cs.setFillBackgroundColor(new HSSFColor.RED().getIndex());
    
    or, for the special case of SOLID_FILL:
    cs.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
    cs.setFillForegroundColor(new HSSFColor.RED().getIndex());
    
    It is necessary to set the fill style in order for the color to be shown in the cell.
 public  void setFillForegroundColor(short bg) 
    set the foreground fill color Note: Ensure Foreground color is set prior to background color.
 public  void setFillPattern(short fp) 
    setting to one fills the cell with the foreground color... No idea about other values
 public  void setFont(HSSFFont font) 
    set the font for this style
 public  void setHidden(boolean hidden) 
    set the cell's using this style to be hidden
 public  void setIndention(short indent) 
    set the number of spaces to indent the text in the cell
 public  void setLeftBorderColor(short color) 
    set the color to use for the left border
 public  void setLocked(boolean locked) 
    set the cell's using this style to be locked
 public  void setRightBorderColor(short color) 
    set the color to use for the right border
 public  void setRotation(short rotation) 
    set the degree of rotation for the text in the cell
 public  void setTopBorderColor(short color) 
    set the color to use for the top border
 public  void setVerticalAlignment(short align) 
    set the type of vertical alignment for the cell
 public  void setWrapText(boolean wrapped) 
    set whether the text should be wrapped