Class XSSFNamedStyle

    • Constructor Detail

      • XSSFNamedStyle

        public XSSFNamedStyle​(String name,
                              boolean custom,
                              int builtinId,
                              int xfId,
                              org.apache.poi.xssf.model.StylesTable stylesSource,
                              org.apache.poi.xssf.model.ThemesTable theme)
    • Method Detail

      • getCellStyle

        public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellStyle getCellStyle()
      • 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
        Returns:
        unique index number of the underlying record this style represents (probably you don't care unless you're comparing which one is which)
      • 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
        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
        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
        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
        Returns:
        hidden - whether the cell using this style should be locked
      • setQuotePrefixed

        public void setQuotePrefixed​(boolean quotePrefix)
        Description copied from interface: CellStyle
        Turn on or off "Quote Prefix" or "123 Prefix" for the style, which is used to tell Excel that the thing which looks like a number or a formula shouldn't be treated as on. Turning this on is somewhat (but not completely, see IgnoredErrorType) like prefixing the cell value with a ' in Excel
        Specified by:
        setQuotePrefixed in interface CellStyle
      • getQuotePrefixed

        public boolean getQuotePrefixed()
        Description copied from interface: CellStyle
        Is "Quote Prefix" or "123 Prefix" enabled for the cell? Having this on is somewhat (but not completely, see IgnoredErrorType) like prefixing the cell value with a ' in Excel
        Specified by:
        getQuotePrefixed in interface CellStyle
      • setAlignment

        public void setAlignment​(HorizontalAlignment align)
        Description copied from interface: CellStyle
        set the type of horizontal alignment for the cell
        Specified by:
        setAlignment in interface CellStyle
        Parameters:
        align - - the type of alignment
      • getAlignment

        public HorizontalAlignment getAlignment()
        Description copied from interface: CellStyle
        get the type of horizontal alignment for the cell
        Specified by:
        getAlignment in interface CellStyle
        Returns:
        align - the type of alignment
      • 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
        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
        Returns:
        wrap text or not
      • setVerticalAlignment

        public void setVerticalAlignment​(VerticalAlignment align)
        Description copied from interface: CellStyle
        set the type of vertical alignment for the cell
        Specified by:
        setVerticalAlignment in interface CellStyle
        Parameters:
        align - the type of alignment
      • 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
        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
        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
        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
        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
        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
        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
        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
        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
        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
        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
        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
        Returns:
        border type
      • setLeftBorderColor

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

        public short getLeftBorderColor()
        Description copied from interface: CellStyle
        get the color to use for the left border
        Specified by:
        getLeftBorderColor in interface CellStyle
      • setRightBorderColor

        public void setRightBorderColor​(short color)
        Description copied from interface: CellStyle
        set the color to use for the right border
        Specified by:
        setRightBorderColor in interface CellStyle
        Parameters:
        color - The index of the color definition
      • getRightBorderColor

        public short getRightBorderColor()
        Description copied from interface: CellStyle
        get the color to use for the left border
        Specified by:
        getRightBorderColor in interface CellStyle
        Returns:
        the index of the color definition
      • setTopBorderColor

        public void setTopBorderColor​(short color)
        Description copied from interface: CellStyle
        set the color to use for the top border
        Specified by:
        setTopBorderColor in interface CellStyle
        Parameters:
        color - The index of the color definition
      • getTopBorderColor

        public short getTopBorderColor()
        Description copied from interface: CellStyle
        get the color to use for the top border
        Specified by:
        getTopBorderColor in interface CellStyle
        Returns:
        the index of the color definition
      • setBottomBorderColor

        public void setBottomBorderColor​(short color)
        Description copied from interface: CellStyle
        set the color to use for the bottom border
        Specified by:
        setBottomBorderColor in interface CellStyle
        Parameters:
        color - The index of the color definition
      • getBottomBorderColor

        public short getBottomBorderColor()
        Description copied from interface: CellStyle
        get the color to use for the left border
        Specified by:
        getBottomBorderColor in interface CellStyle
        Returns:
        the index of the color definition
      • setFillBackgroundColor

        public void setFillBackgroundColor​(short bg)
        Description copied from interface: CellStyle
        set the background fill color.
        Specified by:
        setFillBackgroundColor in interface CellStyle
        Parameters:
        bg - color
      • setFillBackgroundColor

        public void setFillBackgroundColor​(Color color)
        Description copied from interface: CellStyle
        Set the background fill color. Uses a Color instead of an indexed color.
        Specified by:
        setFillBackgroundColor in interface CellStyle
        Parameters:
        color - org.apache.poi.ss.usermodel.Color to set
      • getFillBackgroundColor

        public short getFillBackgroundColor()
        Description copied from interface: CellStyle
        get the background fill color, if the fill is defined with an indexed color.
        Specified by:
        getFillBackgroundColor in interface CellStyle
        Returns:
        fill color index, or 0 if not indexed (XSSF only)
      • getFillBackgroundColorColor

        public Color getFillBackgroundColorColor()
        Description copied from interface: CellStyle
        Gets the color object representing the current background fill, resolving indexes using the supplied workbook. This will work for both indexed and rgb defined colors.
        Specified by:
        getFillBackgroundColorColor in interface CellStyle
      • setFillForegroundColor

        public void setFillForegroundColor​(short bg)
        Description copied from interface: CellStyle
        set the foreground fill color Note: Ensure Foreground color is set prior to background color.
        Specified by:
        setFillForegroundColor in interface CellStyle
        Parameters:
        bg - color
      • setFillForegroundColor

        public void setFillForegroundColor​(Color color)
        Description copied from interface: CellStyle
        Set the foreground fill color. Uses a Color instead of an indexed color.
        Specified by:
        setFillForegroundColor in interface CellStyle
        Parameters:
        color - org.apache.poi.ss.usermodel.Color to set
      • getFillForegroundColor

        public short getFillForegroundColor()
        Description copied from interface: CellStyle
        get the foreground fill color, if the fill is defined with an indexed color.
        Specified by:
        getFillForegroundColor in interface CellStyle
        Returns:
        fill color, or 0 if not indexed (XSSF only)
      • getFillForegroundColorColor

        public Color getFillForegroundColorColor()
        Description copied from interface: CellStyle
        Gets the color object representing the current foreground fill, resolving indexes using the supplied workbook. This will work for both indexed and rgb defined colors.
        Specified by:
        getFillForegroundColorColor in interface CellStyle
      • cloneStyleFrom

        public void cloneStyleFrom​(CellStyle source)
        Description copied from interface: CellStyle
        Clones all the style information from another CellStyle, onto this one. This CellStyle will then have all the same properties as the source, but the two may be edited independently. Any stylings on this CellStyle will be lost! The source CellStyle could be from another Workbook if you like. This allows you to copy styles from one Workbook to another. However, both of the CellStyles will need to be of the same type (HSSFCellStyle or XSSFCellStyle)
        Specified by:
        cloneStyleFrom in interface CellStyle
      • setShrinkToFit

        public void setShrinkToFit​(boolean shrinkToFit)
        Description copied from interface: CellStyle
        Controls if the Cell should be auto-sized to shrink to fit if the text is too long
        Specified by:
        setShrinkToFit in interface CellStyle
      • getShrinkToFit

        public boolean getShrinkToFit()
        Description copied from interface: CellStyle
        Should the Cell be auto-sized by Excel to shrink it to fit if this text is too long?
        Specified by:
        getShrinkToFit in interface CellStyle