org.apache.poi.xssf.usermodel

## Class XSSFClientAnchor

- java.lang.Object
- - org.apache.poi.xssf.usermodel.XSSFAnchor
  - - org.apache.poi.xssf.usermodel.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 `AnchorType`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.poi.ss.usermodel.ClientAnchor

      `ClientAnchor.AnchorType`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `XSSFClientAnchor()` Creates a new client anchor and defaults all the anchor positions to 0.
    `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.
    `` | `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.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(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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.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`
    `org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker` | `getFrom()` Return starting anchor point
    `org.openxmlformats.schemas.drawingml.x2006.main.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.
    `org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D` | `getSize()`
    `org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.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`
    `protected void` | `setFrom(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker from)`
    `void` | `setPosition(org.openxmlformats.schemas.drawingml.x2006.main.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(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D size)` Sets the size of the object.
    `protected void` | `setTo(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker to)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### XSSFClientAnchor

          public XSSFClientAnchor()

      Creates a new client anchor and defaults all the anchor positions to 0. Sets the type to `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 `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 `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 `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 `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

    - #### getCol1

          public short getCol1()

      Description copied from interface: `ClientAnchor`
      Returns the column (0 based) of the first cell, or -1 if there is no top-left anchor cell. This is the case for absolute positioning `ClientAnchor.AnchorType.MOVE_AND_RESIZE`
      Specified by:
        `getCol1` in interface `ClientAnchor`
      Returns:
        0-based column of the first cell or -1 if none.

    - #### setCol1

          public void setCol1(int col1)

      Description copied from interface: `ClientAnchor`
      Sets the column (0 based) of the first cell.
      Specified by:
        `setCol1` in interface `ClientAnchor`
      Parameters:
        `col1` - 0-based column of the first cell.
      Throws:
        `java.lang.NullPointerException` - if cell1 is null (fixed position)
      See Also:
        `ClientAnchor.setCol1(int)`

    - #### getCol2

          public short getCol2()

      Description copied from interface: `ClientAnchor`
      Returns the column (0 based) of the second cell, or -1 if there is no bottom-right anchor cell. This is the case for absolute positioning (`ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE`) and absolute sizing (`ClientAnchor.AnchorType.MOVE_DONT_RESIZE`.
      Specified by:
        `getCol2` in interface `ClientAnchor`
      Returns:
        0-based column of the second cell or -1 if none.

    - #### setCol2

          public void setCol2(int col2)

      Description copied from interface: `ClientAnchor`
      Returns the column (0 based) of the second cell.
      Specified by:
        `setCol2` in interface `ClientAnchor`
      Parameters:
        `col2` - 0-based column of the second cell.
      Throws:
        `java.lang.NullPointerException` - if cell2 is null (fixed size)
      See Also:
        `ClientAnchor.setCol2(int)`

    - #### getRow1

          public int getRow1()

      Description copied from interface: `ClientAnchor`
      Returns the row (0 based) of the first cell, or -1 if there is no bottom-right anchor cell. This is the case for absolute positioning (`ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE`).
      Specified by:
        `getRow1` in interface `ClientAnchor`
      Returns:
        0-based row of the first cell or -1 if none.

    - #### setRow1

          public void setRow1(int row1)

      Description copied from interface: `ClientAnchor`
      Returns the row (0 based) of the first cell.
      Specified by:
        `setRow1` in interface `ClientAnchor`
      Parameters:
        `row1` - 0-based row of the first cell.
      Throws:
        `java.lang.NullPointerException` - if cell1 is null (fixed position)
      See Also:
        `ClientAnchor.setRow1(int)`

    - #### getRow2

          public int getRow2()

      Description copied from interface: `ClientAnchor`
      Returns the row (0 based) of the second cell, or -1 if there is no bottom-right anchor cell. This is the case for absolute positioning (`ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE`) and absolute sizing (`ClientAnchor.AnchorType.MOVE_DONT_RESIZE`.
      Specified by:
        `getRow2` in interface `ClientAnchor`
      Returns:
        0-based row of the second cell or -1 if none.

    - #### setRow2

          public void setRow2(int row2)

      Description copied from interface: `ClientAnchor`
      Returns the row (0 based) of the first cell.
      Specified by:
        `setRow2` in interface `ClientAnchor`
      Parameters:
        `row2` - 0-based row of the first cell.
      Throws:
        `java.lang.NullPointerException` - if cell2 is null (fixed size)
      See Also:
        `ClientAnchor.setRow2(int)`

    - #### getDx1

          public int getDx1()

      Description copied from interface: `ClientAnchor`
      Returns 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`
      Specified by:
        `getDx1` in interface `ChildAnchor`
      Specified by:
        `getDx1` in interface `ClientAnchor`
      Returns:
        the x coordinate within the first cell

    - #### setDx1

          public void setDx1(int dx1)

      Description copied from interface: `ClientAnchor`
      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`
      Specified by:
        `setDx1` in interface `ChildAnchor`
      Specified by:
        `setDx1` in interface `ClientAnchor`
      Parameters:
        `dx1` - the x coordinate within the first cell
      Throws:
        `java.lang.NullPointerException` - if cell1 is null (fixed position)
      See Also:
        `ChildAnchor.setDx1(int)`

    - #### getDy1

          public int getDy1()

      Description copied from interface: `ClientAnchor`
      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`
      Specified by:
        `getDy1` in interface `ChildAnchor`
      Specified by:
        `getDy1` in interface `ClientAnchor`
      Returns:
        the y coordinate within the first cell

    - #### setDy1

          public void setDy1(int dy1)

      Description copied from interface: `ClientAnchor`
      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`
      Specified by:
        `setDy1` in interface `ChildAnchor`
      Specified by:
        `setDy1` in interface `ClientAnchor`
      Parameters:
        `dy1` - the y coordinate within the first cell
      Throws:
        `java.lang.NullPointerException` - if cell1 is null (fixed position)
      See Also:
        `ChildAnchor.setDy1(int)`

    - #### getDy2

          public int getDy2()

      Description copied from interface: `ClientAnchor`
      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`
      Specified by:
        `getDy2` in interface `ChildAnchor`
      Specified by:
        `getDy2` in interface `ClientAnchor`
      Returns:
        the y coordinate within the second cell

    - #### setDy2

          public void setDy2(int dy2)

      Description copied from interface: `ClientAnchor`
      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`
      Specified by:
        `setDy2` in interface `ChildAnchor`
      Specified by:
        `setDy2` in interface `ClientAnchor`
      Parameters:
        `dy2` - the y coordinate within the second cell
      Throws:
        `java.lang.NullPointerException` - if cell2 is null (fixed size)
      See Also:
        `ChildAnchor.setDy2(int)`

    - #### getDx2

          public int getDx2()

      Description copied from interface: `ClientAnchor`
      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`
      Specified by:
        `getDx2` in interface `ChildAnchor`
      Specified by:
        `getDx2` in interface `ClientAnchor`
      Returns:
        the x coordinate within the second cell

    - #### setDx2

          public void setDx2(int dx2)

      Description copied from interface: `ClientAnchor`
      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`
      Specified by:
        `setDx2` in interface `ChildAnchor`
      Specified by:
        `setDx2` in interface `ClientAnchor`
      Parameters:
        `dx2` - the x coordinate within the second cell
      Throws:
        `java.lang.NullPointerException` - if cell2 is null (fixed size)
      See Also:
        `ChildAnchor.setDx2(int)`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.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.
      Parameters:
        `position` -
      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.
      Parameters:
        `size` -
      Since:
        POI 3.17 beta 1

    - #### setAnchorType

          public void setAnchorType(ClientAnchor.AnchorType anchorType)

      Sets the anchor type
      Specified by:
        `setAnchorType` in interface `ClientAnchor`
      Parameters:
        `anchorType` - the anchor type to set
      Since:
        POI 3.14

    - #### getAnchorType

          public ClientAnchor.AnchorType getAnchorType()

      Gets the anchor type Changed from returning an int to an enum in POI 3.14 beta 1.
      Specified by:
        `getAnchorType` in interface `ClientAnchor`
      Returns:
        the anchor type

    - #### isSet

          public boolean isSet()

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.