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 
      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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(Object o)  
      ClientAnchor.AnchorType getAnchorType()
      Gets the anchor type Changed from returning an int to an enum in POI 3.14 beta 1.
      short getCol1()
      Returns the column (0 based) of the first cell, or -1 if there is no top-left anchor cell.
      short getCol2()
      Returns the column (0 based) of the second cell, or -1 if there is no bottom-right anchor cell.
      int getDx1()
      Returns the x coordinate within the first cell.
      int getDx2()
      Returns the x coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of Units.EMU_PER_PIXEL
      int getDy1()
      Returns the y coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of Units.EMU_PER_PIXEL
      int getDy2()
      Sets the y coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of Units.EMU_PER_PIXEL
      CTMarker getFrom()
      Return starting anchor point
      CTPoint2D getPosition()  
      int getRow1()
      Returns the row (0 based) of the first cell, or -1 if there is no bottom-right anchor cell.
      int getRow2()
      Returns the row (0 based) of the second cell, or -1 if there is no bottom-right anchor cell.
      CTPositiveSize2D getSize()  
      CTMarker getTo()
      Return ending anchor point
      int hashCode()  
      boolean isSet()  
      void setAnchorType​(ClientAnchor.AnchorType anchorType)
      Sets the anchor type
      void setCol1​(int col1)
      Sets the column (0 based) of the first cell.
      void setCol2​(int col2)
      Returns the column (0 based) of the second cell.
      void setDx1​(int dx1)
      Sets the x coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of Units.EMU_PER_PIXEL
      void setDx2​(int dx2)
      Sets the x coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of Units.EMU_PER_PIXEL
      void setDy1​(int dy1)
      Sets the y coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of Units.EMU_PER_PIXEL
      void setDy2​(int dy2)
      Sets the y coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of Units.EMU_PER_PIXEL
      void setPosition​(CTPoint2D position)
      Sets the top-left absolute position of the object.
      void setRow1​(int row1)
      Returns the row (0 based) of the first cell.
      void setRow2​(int row2)
      Returns the row (0 based) of the first cell.
      void setSize​(CTPositiveSize2D size)
      Sets the size of the object.
      String toString()  
    • 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.