Package ch.rabanti.nanoxlsx4j.styles
Class CellXf
java.lang.Object
ch.rabanti.nanoxlsx4j.styles.AbstractStyle
ch.rabanti.nanoxlsx4j.styles.CellXf
- All Implemented Interfaces:
Comparable<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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum for the horizontal alignment of a cellstatic enumEnum for text break optionsstatic enumEnum for the general text alignment directionstatic enumEnum for the vertical alignment of a cell -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CellXf.TextBreakValueDefault text break value as constantstatic final CellXf.HorizontalAlignValueDefault horizontal align value as constantstatic final CellXf.TextDirectionValueDefault text direction value as constantstatic final CellXf.VerticalAlignValueDefault vertical align value as constant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintMethod to calculate the internal text rotation.copy()Method to copy the current object to a new oneGets the text break options of the styleGets the horizontal alignment of the styleintGets the indentation in case of left, right or distributed alignment.Gets the direction of the text within the cellintGets the text rotation in degrees (from +90 to -90)Gets the vertical alignment of the styleinthashCode()Override method to calculate the hash of this componentbooleanGets whether the applyAlignment property (used to merge cells) will be defined in the XF entry of the style.booleanisHidden()Gets whether the hidden property (used for protection or hiding of cells) will be defined in the XF entry of the style.booleanisLocked()Gets whether the locked property (used for locking / protection of cells or worksheets) will be defined in the XF entry of the style.voidsetAlignment(CellXf.TextBreakValue alignment) Sets the text break options of the stylevoidsetForceApplyAlignment(boolean forceApplyAlignment) Sets whether the applyAlignment property (used to merge cells) will be defined in the XF entry of the style.voidsetHidden(boolean hidden) Sets whether the hidden property (used for protection or hiding of cells) will be defined in the XF entry of the style.voidsetHorizontalAlign(CellXf.HorizontalAlignValue horizontalAlign) Sets the horizontal alignment of the stylevoidsetIndent(int indent) Sets the indentation in case of left, right or distributed alignment.voidsetLocked(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.voidsetTextDirection(CellXf.TextDirectionValue textDirection) Sets the direction of the text within the cellvoidsetTextRotation(int textRotation) Sets the text rotation in degrees (from +90 to -90)voidsetVerticalAlign(CellXf.VerticalAlignValue verticalAlign) Sets the vertical alignment of the styletoString()Override toString methodMethods inherited from class ch.rabanti.nanoxlsx4j.styles.AbstractStyle
compareTo, equals, getInternalID, setInternalID
-
Field Details
-
DEFAULT_HORIZONTAL_ALIGNMENT
Default horizontal align value as constant -
DEFAULT_ALIGNMENT
Default text break value as constant -
DEFAULT_TEXT_DIRECTION
Default text direction value as constant -
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
Gets the direction of the text within the cell- Returns:
- Direction of the text within the cell
-
setTextDirection
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
Gets the horizontal alignment of the style- Returns:
- Horizontal alignment of the style
-
setHorizontalAlign
Sets the horizontal alignment of the style- Parameters:
horizontalAlign- Horizontal alignment of the style
-
getVerticalAlign
Gets the vertical alignment of the style- Returns:
- Vertical alignment of the style
-
setVerticalAlign
Sets the vertical alignment of the style- Parameters:
verticalAlign- Vertical alignment of the style
-
getAlignment
Gets the text break options of the style- Returns:
- Text break options of the style
-
setAlignment
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
Override toString method -
copy
Method to copy the current object to a new one- Specified by:
copyin classAbstractStyle- Returns:
- Copy of the current object without the internal ID
-
hashCode
public int hashCode()Override method to calculate the hash of this component
-