Class CellXf

All Implemented Interfaces:
Comparable<AbstractStyle>

public class CellXf extends AbstractStyle
Class representing an XF entry. The XF entry is used to make reference to other style instances like Border or Fill and for the positioning of the cell content
Author:
Raphael Stoeckli
  • Field Details

    • DEFAULT_HORIZONTAL_ALIGNMENT

      public static final CellXf.HorizontalAlignValue DEFAULT_HORIZONTAL_ALIGNMENT
      Default horizontal align value as constant
    • DEFAULT_ALIGNMENT

      public static final CellXf.TextBreakValue DEFAULT_ALIGNMENT
      Default text break value as constant
    • DEFAULT_TEXT_DIRECTION

      public static final CellXf.TextDirectionValue DEFAULT_TEXT_DIRECTION
      Default text direction value as constant
    • DEFAULT_VERTICAL_ALIGNMENT

      public static final CellXf.VerticalAlignValue DEFAULT_VERTICAL_ALIGNMENT
      Default vertical align value as constant
  • Constructor Details

    • CellXf

      public CellXf()
      Default constructor
  • Method Details

    • getTextRotation

      public int getTextRotation()
      Gets the text rotation in degrees (from +90 to -90)
      Returns:
      Text rotation in degrees (from +90 to -90)
    • setTextRotation

      public void setTextRotation(int textRotation)
      Sets the text rotation in degrees (from +90 to -90)
      Parameters:
      textRotation - Text rotation in degrees (from +90 to -90)
      Throws:
      RangeException - Thrown if the rotation angle is out of range
    • getTextDirection

      public CellXf.TextDirectionValue getTextDirection()
      Gets the direction of the text within the cell
      Returns:
      Direction of the text within the cell
    • setTextDirection

      public void setTextDirection(CellXf.TextDirectionValue textDirection)
      Sets the direction of the text within the cell
      Parameters:
      textDirection - Direction of the text within the cell
      Throws:
      RangeException - Thrown if the text rotation and direction causes a conflict
    • getHorizontalAlign

      public CellXf.HorizontalAlignValue getHorizontalAlign()
      Gets the horizontal alignment of the style
      Returns:
      Horizontal alignment of the style
    • setHorizontalAlign

      public void setHorizontalAlign(CellXf.HorizontalAlignValue horizontalAlign)
      Sets the horizontal alignment of the style
      Parameters:
      horizontalAlign - Horizontal alignment of the style
    • getVerticalAlign

      public CellXf.VerticalAlignValue getVerticalAlign()
      Gets the vertical alignment of the style
      Returns:
      Vertical alignment of the style
    • setVerticalAlign

      public void setVerticalAlign(CellXf.VerticalAlignValue verticalAlign)
      Sets the vertical alignment of the style
      Parameters:
      verticalAlign - Vertical alignment of the style
    • getAlignment

      public CellXf.TextBreakValue getAlignment()
      Gets the text break options of the style
      Returns:
      Text break options of the style
    • setAlignment

      public void setAlignment(CellXf.TextBreakValue alignment)
      Sets the text break options of the style
      Parameters:
      alignment - Text break options of the style
    • isLocked

      public boolean isLocked()
      Gets whether the locked property (used for locking / protection of cells or worksheets) will be defined in the XF entry of the style. If true, locked will be defined
      Returns:
      If true, the style is used for locking / protection of cells or worksheets
    • setLocked

      public void setLocked(boolean locked)
      Sets whether the locked property (used for locking / protection of cells or worksheets) will be defined in the XF entry of the style. If true, locked will be defined
      Parameters:
      locked - If true, the style is used for locking / protection of cells or worksheets
    • isHidden

      public boolean isHidden()
      Gets whether the hidden property (used for protection or hiding of cells) will be defined in the XF entry of the style. If true, hidden will be defined
      Returns:
      If true, the style is used for hiding cell values / protection of cells
    • setHidden

      public void setHidden(boolean hidden)
      Sets whether the hidden property (used for protection or hiding of cells) will be defined in the XF entry of the style. If true, hidden will be defined
      Parameters:
      hidden - If true, the style is used for hiding cell values / protection of cells
    • isForceApplyAlignment

      public boolean isForceApplyAlignment()
      Gets whether the applyAlignment property (used to merge cells) will be defined in the XF entry of the style. If true, applyAlignment will be defined
      Returns:
      If true, the applyAlignment value of the style will be set to true (used to merge cells)
    • setForceApplyAlignment

      public void setForceApplyAlignment(boolean forceApplyAlignment)
      Sets whether the applyAlignment property (used to merge cells) will be defined in the XF entry of the style. If true, applyAlignment will be defined
      Parameters:
      forceApplyAlignment - If true, the applyAlignment value of the style will be set to true (used to merge cells)
    • getIndent

      public int getIndent()
      Gets the indentation in case of left, right or distributed alignment. If 0, no alignment is applied
      Returns:
      Indentation level
    • setIndent

      public void setIndent(int indent)
      Sets the indentation in case of left, right or distributed alignment. If 0, no alignment is applied
      Parameters:
      indent - Indentation level
    • calculateInternalRotation

      public int calculateInternalRotation()
      Method to calculate the internal text rotation. The text direction and rotation are handled internally by the text rotation value
      Returns:
      Returns the valid rotation in degrees for internal use (LowLevel)
      Throws:
      RangeException - Thrown if the rotation is out of range
    • toString

      public String toString()
      Override toString method
      Overrides:
      toString in class Object
      Returns:
      String of a class instance
    • copy

      public CellXf copy()
      Method to copy the current object to a new one
      Specified by:
      copy in class AbstractStyle
      Returns:
      Copy of the current object without the internal ID
    • hashCode

      public int hashCode()
      Override method to calculate the hash of this component
      Overrides:
      hashCode in class Object
      Implementation Note:
      Note that autogenerated hashcode algorithms may cause collisions. Do not use 0 as fallback value for every field
      Returns:
      Calculated hash as string