Class XSSFDxfCellStyle

    • Constructor Detail

      • XSSFDxfCellStyle

        public XSSFDxfCellStyle​(org.apache.poi.xssf.model.StylesTable stylesSource,
                                org.apache.poi.xssf.model.ThemesTable theme)
        Creates an empty Cell Style with theme
        Since:
        3.8.2
      • XSSFDxfCellStyle

        public XSSFDxfCellStyle​(int dxfId,
                                org.apache.poi.xssf.model.StylesTable stylesSource,
                                org.apache.poi.xssf.model.ThemesTable theme)
    • Method Detail

      • setIndex

        public void setIndex​(int dxfId)
      • getDxf

        public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxf getDxf()
      • getIndex

        public short getIndex()
        Description copied from interface: CellStyle
        get the index within the Workbook (sequence within the collection of ExtendedFormat objects)
        Specified by:
        getIndex in interface CellStyle
        Overrides:
        getIndex in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        unique index number of the underlying record this style represents (probably you don't care unless you're comparing which one is which)
      • setDataFormat

        public void setDataFormat​(short fmt)
        Description copied from interface: CellStyle
        set the data format (must be a valid format). Built in formats are defined at BuiltinFormats.
        Specified by:
        setDataFormat in interface CellStyle
        Overrides:
        setDataFormat in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        See Also:
        DataFormat
      • getDataFormat

        public short getDataFormat()
        Description copied from interface: CellStyle
        get the index of the data format. Built in formats are defined at BuiltinFormats.
        Specified by:
        getDataFormat in interface CellStyle
        Overrides:
        getDataFormat in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        See Also:
        DataFormat
      • getDataFormatString

        public String getDataFormatString()
        Description copied from interface: CellStyle
        Get the format string
        Specified by:
        getDataFormatString in interface CellStyle
        Overrides:
        getDataFormatString in class org.apache.poi.xssf.usermodel.XSSFCellStyle
      • getRawDataFormatString

        public String getRawDataFormatString()
      • setFont

        public void setFont​(Font font)
        Description copied from interface: CellStyle
        set the font for this style
        Specified by:
        setFont in interface CellStyle
        Overrides:
        setFont in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        font - a font object created or retrieved from the Workbook object
        See Also:
        Workbook.createFont(), Workbook.getFontAt(int)
      • getOrCreateFont

        public org.apache.poi.xssf.usermodel.XSSFFont getOrCreateFont()
        Gets or create the font for this style
        Returns:
        XSSFFont - font
      • getFontIndex

        public int getFontIndex()
        Description copied from interface: CellStyle
        gets the index of the font for this style
        Specified by:
        getFontIndex in interface CellStyle
        Overrides:
        getFontIndex in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        See Also:
        Workbook.getFontAt(int)
      • setHidden

        public void setHidden​(boolean hidden)
        Description copied from interface: CellStyle
        set the cell's using this style to be hidden
        Specified by:
        setHidden in interface CellStyle
        Overrides:
        setHidden in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        hidden - - whether the cell using this style should be hidden
      • getHidden

        public boolean getHidden()
        Description copied from interface: CellStyle
        get whether the cell's using this style are to be hidden
        Specified by:
        getHidden in interface CellStyle
        Overrides:
        getHidden in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        hidden - whether the cell using this style should be hidden
      • setLocked

        public void setLocked​(boolean locked)
        Description copied from interface: CellStyle
        set the cell's using this style to be locked
        Specified by:
        setLocked in interface CellStyle
        Overrides:
        setLocked in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        locked - - whether the cell using this style should be locked
      • getLocked

        public boolean getLocked()
        Description copied from interface: CellStyle
        get whether the cell's using this style are to be locked
        Specified by:
        getLocked in interface CellStyle
        Overrides:
        getLocked in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        hidden - whether the cell using this style should be locked
      • setWrapText

        public void setWrapText​(boolean wrapped)
        Description copied from interface: CellStyle
        Set whether the text should be wrapped. Setting this flag to true make all content visible within a cell by displaying it on multiple lines
        Specified by:
        setWrapText in interface CellStyle
        Overrides:
        setWrapText in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        wrapped - wrap text or not
      • getWrapText

        public boolean getWrapText()
        Description copied from interface: CellStyle
        get whether the text should be wrapped
        Specified by:
        getWrapText in interface CellStyle
        Overrides:
        getWrapText in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        wrap text or not
      • setRotation

        public void setRotation​(short rotation)
        Description copied from interface: CellStyle
        set the degree of rotation for the text in the cell. Note: HSSF uses values from -90 to 90 degrees, whereas XSSF uses values from 0 to 180 degrees. The implementations of this method will map between these two value-ranges accordingly, however the corresponding getter is returning values in the range mandated by the current type of Excel file-format that this CellStyle is applied to.
        Specified by:
        setRotation in interface CellStyle
        Overrides:
        setRotation in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        rotation - degrees (see note above)
      • getRotation

        public short getRotation()
        Description copied from interface: CellStyle
        get the degree of rotation for the text in the cell. Note: HSSF uses values from -90 to 90 degrees, whereas XSSF uses values from 0 to 180 degrees. The implementations of this method will map between these two value-ranges value-range as used by the type of Excel file-format that this CellStyle is applied to.
        Specified by:
        getRotation in interface CellStyle
        Overrides:
        getRotation in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        rotation degrees (see note above)
      • setIndention

        public void setIndention​(short indent)
        Description copied from interface: CellStyle
        set the number of spaces to indent the text in the cell
        Specified by:
        setIndention in interface CellStyle
        Overrides:
        setIndention in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        indent - - number of spaces
      • getIndention

        public short getIndention()
        Description copied from interface: CellStyle
        get the number of spaces to indent the text in the cell
        Specified by:
        getIndention in interface CellStyle
        Overrides:
        getIndention in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        indent - number of spaces
      • setBorderLeft

        public void setBorderLeft​(BorderStyle border)
        Description copied from interface: CellStyle
        set the type of border to use for the left border of the cell
        Specified by:
        setBorderLeft in interface CellStyle
        Overrides:
        setBorderLeft in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        border - type
      • getBorderLeft

        public BorderStyle getBorderLeft()
        Description copied from interface: CellStyle
        get the type of border to use for the left border of the cell
        Specified by:
        getBorderLeft in interface CellStyle
        Overrides:
        getBorderLeft in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        border type
      • setBorderRight

        public void setBorderRight​(BorderStyle border)
        Description copied from interface: CellStyle
        set the type of border to use for the right border of the cell
        Specified by:
        setBorderRight in interface CellStyle
        Overrides:
        setBorderRight in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        border - type
      • getBorderRight

        public BorderStyle getBorderRight()
        Description copied from interface: CellStyle
        get the type of border to use for the right border of the cell
        Specified by:
        getBorderRight in interface CellStyle
        Overrides:
        getBorderRight in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        border type
      • setBorderTop

        public void setBorderTop​(BorderStyle border)
        Description copied from interface: CellStyle
        set the type of border to use for the top border of the cell
        Specified by:
        setBorderTop in interface CellStyle
        Overrides:
        setBorderTop in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        border - type
      • getBorderTop

        public BorderStyle getBorderTop()
        Description copied from interface: CellStyle
        get the type of border to use for the top border of the cell
        Specified by:
        getBorderTop in interface CellStyle
        Overrides:
        getBorderTop in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        border type
      • setBorderBottom

        public void setBorderBottom​(BorderStyle border)
        Description copied from interface: CellStyle
        set the type of border to use for the bottom border of the cell
        Specified by:
        setBorderBottom in interface CellStyle
        Overrides:
        setBorderBottom in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        border - type
      • getBorderBottom

        public BorderStyle getBorderBottom()
        Description copied from interface: CellStyle
        get the type of border to use for the bottom border of the cell
        Specified by:
        getBorderBottom in interface CellStyle
        Overrides:
        getBorderBottom in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        border type
      • setFillPattern

        public void setFillPattern​(FillPatternType fp)
        Description copied from interface: CellStyle
        setting to one fills the cell with the foreground color... No idea about other values
        Specified by:
        setFillPattern in interface CellStyle
        Overrides:
        setFillPattern in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        fp - fill pattern (set to FillPatternType.SOLID_FOREGROUND to fill w/foreground color)
      • getCellAlignment

        protected org.apache.poi.xssf.usermodel.extensions.XSSFCellAlignment getCellAlignment()
        get the cellAlignment object to use for manage alignment
        Overrides:
        getCellAlignment in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        XSSFCellAlignment - cell alignment
      • setBorderHorizontal

        public void setBorderHorizontal​(BorderStyle border)
        Description copied from interface: DxfCellStyle
        set the type of border to use for the horizontal border of the cell
        Specified by:
        setBorderHorizontal in interface DxfCellStyle
        Parameters:
        border - type
      • setHorizontalBorderColor

        public void setHorizontalBorderColor​(short color)
        Description copied from interface: DxfCellStyle
        set the color to use for the horizontal border
        Specified by:
        setHorizontalBorderColor in interface DxfCellStyle
        Parameters:
        color - The index of the color definition
      • setBorderVertical

        public void setBorderVertical​(BorderStyle border)
        Description copied from interface: DxfCellStyle
        set the type of border to use for the horizontal border of the cell
        Specified by:
        setBorderVertical in interface DxfCellStyle
        Parameters:
        border - type
      • setVerticalBorderColor

        public void setVerticalBorderColor​(short color)
        Description copied from interface: DxfCellStyle
        set the color to use for the vertical border
        Specified by:
        setVerticalBorderColor in interface DxfCellStyle
        Parameters:
        color - The index of the color definition
      • setBorderDiagonal

        public void setBorderDiagonal​(BorderStyle border)
        Description copied from interface: DxfCellStyle
        set the type of border to use for the diagonal border of the cell
        Specified by:
        setBorderDiagonal in interface DxfCellStyle
        Parameters:
        border - type
      • setDiagonalBorderColor

        public void setDiagonalBorderColor​(short color)
        Description copied from interface: DxfCellStyle
        set the color to use for the diagonal border
        Specified by:
        setDiagonalBorderColor in interface DxfCellStyle
        Parameters:
        color - The index of the color definition
      • setLeftBorderColor

        public void setLeftBorderColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the color to use for the left border as a XSSFColor value
        Overrides:
        setLeftBorderColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        color - the color to use
      • setTopBorderColor

        public void setTopBorderColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the color to use for the left border as a XSSFColor value
        Overrides:
        setTopBorderColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        color - the color to use
      • setRightBorderColor

        public void setRightBorderColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the color to use for the left border as a XSSFColor value
        Overrides:
        setRightBorderColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        color - the color to use
      • setBottomBorderColor

        public void setBottomBorderColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the color to use for the left border as a XSSFColor value
        Overrides:
        setBottomBorderColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        color - the color to use
      • setHorizontalBorderColor

        public void setHorizontalBorderColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the color to use for the left border as a XSSFColor value
        Parameters:
        color - the color to use
      • setVerticalBorderColor

        public void setVerticalBorderColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the color to use for the left border as a XSSFColor value
        Parameters:
        color - the color to use
      • setDiagonalBorderColor

        public void setDiagonalBorderColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the color to use for the left border as a XSSFColor value
        Parameters:
        color - the color to use
      • getLeftBorderXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getLeftBorderXSSFColor()
        Get the color to use for the left border
        Overrides:
        getLeftBorderXSSFColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        the index of the color definition or null if not set
        See Also:
        IndexedColors
      • getTopBorderXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getTopBorderXSSFColor()
        Get the color to use for the top border
        Overrides:
        getTopBorderXSSFColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        the index of the color definition or null if not set
        See Also:
        IndexedColors
      • getRightBorderXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getRightBorderXSSFColor()
        Get the color to use for the right border
        Overrides:
        getRightBorderXSSFColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        the index of the color definition or null if not set
        See Also:
        IndexedColors
      • getBottomBorderXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getBottomBorderXSSFColor()
        Get the color to use for the bottom border
        Overrides:
        getBottomBorderXSSFColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        the index of the color definition or null if not set
        See Also:
        IndexedColors
      • getHorizontalBorderXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getHorizontalBorderXSSFColor()
        Get the color to use for the horizontal border
        Returns:
        the index of the color definition or null if not set
        See Also:
        IndexedColors
      • getVerticalBorderXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getVerticalBorderXSSFColor()
        Get the color to use for the vertical border
        Returns:
        the index of the color definition or null if not set
        See Also:
        IndexedColors
      • getDiagonalBorderXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getDiagonalBorderXSSFColor()
        Get the color to use for the diagonal border
        Returns:
        the index of the color definition or null if not set
        See Also:
        IndexedColors
      • setFillForegroundColor

        public void setFillForegroundColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the foreground fill color represented as a XSSFColor value.
        Note: Ensure Foreground color is set prior to background color.
        Overrides:
        setFillForegroundColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        color - the color to use
        See Also:
        )
      • setFillBackgroundColor

        public void setFillBackgroundColor​(org.apache.poi.xssf.usermodel.XSSFColor color)
        Set the background fill color represented as a XSSFColor value.

        For example:

         cs.setFillPattern(XSSFCellStyle.FINE_DOTS );
         cs.setFillBackgroundXSSFColor(new XSSFColor(java.awt.Color.RED));
         
        optionally a Foreground and background fill can be applied: Note: Ensure Foreground color is set prior to background
         cs.setFillPattern(XSSFCellStyle.FINE_DOTS );
         cs.setFillForegroundColor(new XSSFColor(java.awt.Color.BLUE));
         cs.setFillBackgroundColor(new XSSFColor(java.awt.Color.GREEN));
         
        or, for the special case of SOLID_FILL:
         cs.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND );
         cs.setFillForegroundColor(new XSSFColor(java.awt.Color.GREEN));
         
        It is necessary to set the fill style in order for the color to be shown in the cell.
        Overrides:
        setFillBackgroundColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Parameters:
        color - - the color to use
      • getFillBackgroundXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getFillBackgroundXSSFColor()
        Get the background fill color.

        Note - many cells are actually filled with a foreground fill, not a background fill - see XSSFCellStyle.getFillForegroundColor()

        Overrides:
        getFillBackgroundXSSFColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        XSSFColor - fill color or null if not set
      • getFillForegroundXSSFColor

        public org.apache.poi.xssf.usermodel.XSSFColor getFillForegroundXSSFColor()
        Get the foreground fill color.

        Note - many cells are actually filled with a foreground fill, not a background fill - see XSSFCellStyle.getFillForegroundColor()

        Overrides:
        getFillForegroundXSSFColor in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        Returns:
        XSSFColor - fill color or null if not set
      • getFontIndexAsInt

        public int getFontIndexAsInt()
        Description copied from interface: CellStyle
        gets the index of the font for this style
        Specified by:
        getFontIndexAsInt in interface CellStyle
        Overrides:
        getFontIndexAsInt in class org.apache.poi.xssf.usermodel.XSSFCellStyle
        See Also:
        Workbook.getFontAt(int)
      • setFill

        public void setFill​(Color fillColor,
                            Color backColor,
                            short patternType)
      • getDxfIndex

        public int getDxfIndex()