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
    • Constructor Detail

      • CellXf

        public CellXf()
        Default constructor
    • Method Detail

      • 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)
      • 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 uses (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
        Returns:
        Calculated hash as string