Class XSSFClientAnchor

  • All Implemented Interfaces:
    ChildAnchor, ClientAnchor

    public class XSSFClientAnchor
    extends XSSFAnchor
    implements ClientAnchor
    A client anchor is attached to an excel worksheet. It anchors against:
    1. A fixed position and fixed size
    2. A position relative to a cell (top-left) and a fixed size
    3. A position relative to a cell (top-left) and sized relative to another cell (bottom right)
    which method is used is determined by the ClientAnchor.AnchorType.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        XSSFClientAnchor()
      Creates a new client anchor and defaults all the anchor positions to 0.
        XSSFClientAnchor​(int dx1, int dy1, int dx2, int dy2, int col1, int row1, int col2, int row2)
      Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor by cell references and offsets.
      protected XSSFClientAnchor​(XSSFSheet sheet, org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D position, org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D size)
      Create XSSFClientAnchor from existing xml beans, sized and positioned relative to a pair of cells.
      protected XSSFClientAnchor​(XSSFSheet sheet, org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker cell1, org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D size)
      Create XSSFClientAnchor from existing xml beans, sized and positioned relative to a pair of cells.
      protected XSSFClientAnchor​(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker cell1, org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker cell2)
      Create XSSFClientAnchor from existing xml beans, sized and positioned relative to a pair of cells.
    • Constructor Detail

      • XSSFClientAnchor

        public XSSFClientAnchor()
        Creates a new client anchor and defaults all the anchor positions to 0. Sets the type to ClientAnchor.AnchorType.MOVE_AND_RESIZE relative to cell range A1:A1.
      • XSSFClientAnchor

        public XSSFClientAnchor​(int dx1,
                                int dy1,
                                int dx2,
                                int dy2,
                                int col1,
                                int row1,
                                int col2,
                                int row2)
        Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor by cell references and offsets. Sets the type to ClientAnchor.AnchorType.MOVE_AND_RESIZE.
        Parameters:
        dx1 - the x coordinate within the first cell.
        dy1 - the y coordinate within the first cell.
        dx2 - the x coordinate within the second cell.
        dy2 - the y coordinate within the second cell.
        col1 - the column (0 based) of the first cell.
        row1 - the row (0 based) of the first cell.
        col2 - the column (0 based) of the second cell.
        row2 - the row (0 based) of the second cell.
      • XSSFClientAnchor

        protected XSSFClientAnchor​(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker cell1,
                                   org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker cell2)
        Create XSSFClientAnchor from existing xml beans, sized and positioned relative to a pair of cells. Sets the type to ClientAnchor.AnchorType.MOVE_AND_RESIZE.
        Parameters:
        cell1 - starting anchor point
        cell2 - ending anchor point
      • XSSFClientAnchor

        protected XSSFClientAnchor​(XSSFSheet sheet,
                                   org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker cell1,
                                   org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D size)
        Create XSSFClientAnchor from existing xml beans, sized and positioned relative to a pair of cells. Sets the type to ClientAnchor.AnchorType.MOVE_DONT_RESIZE.
        Parameters:
        sheet - needed to calculate ending point based on column/row sizes
        cell1 - starting anchor point
        size - object size, to calculate ending anchor point
      • XSSFClientAnchor

        protected XSSFClientAnchor​(XSSFSheet sheet,
                                   org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D position,
                                   org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D size)
        Create XSSFClientAnchor from existing xml beans, sized and positioned relative to a pair of cells. Sets the type to ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE.
        Parameters:
        sheet - needed to calculate starting and ending points based on column/row sizes
        position - starting absolute position
        size - object size, to calculate ending position
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getFrom

        @Internal
        public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker getFrom()
        Return starting anchor point
        Returns:
        starting anchor point
      • setFrom

        protected void setFrom​(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker from)
      • getTo

        @Internal
        public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker getTo()
        Return ending anchor point
        Returns:
        ending anchor point
      • setTo

        protected void setTo​(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker to)
      • getPosition

        public org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D getPosition()
        Returns:
        absolute top-left position, or null if position is determined from the "from" cell
        Since:
        POI 3.17 beta 1
      • setPosition

        public void setPosition​(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D position)
        Sets the top-left absolute position of the object. To use this, "from" must be set to null.
        Since:
        POI 3.17 beta 1
      • getSize

        public org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D getSize()
        Returns:
        size or null, if size is determined from the to and from cells
        Since:
        POI 3.17 beta 1
      • setSize

        public void setSize​(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D size)
        Sets the size of the object. To use this, "to" must be set to null.
        Since:
        POI 3.17 beta 1
      • isSet

        public boolean isSet()