Top Description Inners Methods
org.apache.poi.ss.usermodel

public Interface ClientAnchor

Known Direct Implementers
org.apache.poi.hssf.usermodel.HSSFClientAnchor
Imports
org.apache.poi.util.Internal

A client anchor is attached to an excel worksheet. It anchors against absolute coordinates, a top-left cell and fixed height and width, or a top-left and bottom-right cell, depending on the AnchorType:
  1. AnchorType#DONT_MOVE_AND_RESIZE == absolute top-left coordinates and width/height, no cell references
  2. AnchorType#MOVE_DONT_RESIZE == fixed top-left cell reference, absolute width/height
  3. AnchorType#MOVE_AND_RESIZE == fixed top-left and bottom-right cell references, dynamic width/height
Note this class only reports the current values for possibly calculated positions and sizes. If the sheet row/column sizes or positions shift, this needs updating via external calculations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Method Summary

Modifier and TypeMethod and Description
public ClientAnchor.AnchorType

Returns:

the anchor type
getAnchorType
()

Gets the anchor type Changed from returning an int to an enum in POI 3.14 beta 1.

public short

Returns:

0-based column of the first cell or -1 if none.
getCol1
()

Returns the column (0 based) of the first cell, or -1 if there is no top-left anchor cell.

public short

Returns:

0-based column of the second cell or -1 if none.
getCol2
()

Returns the column (0 based) of the second cell, or -1 if there is no bottom-right anchor cell.

public int

Returns:

the x coordinate within the first cell
getDx1
()

Returns the x coordinate within the first cell.

public int

Returns:

the x coordinate within the second cell
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 org.apache.poi.util.Units#EMU_PER_PIXEL

public int

Returns:

the y coordinate within the first cell
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 org.apache.poi.util.Units#EMU_PER_PIXEL

public int

Returns:

the y coordinate within the second cell
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 org.apache.poi.util.Units#EMU_PER_PIXEL

public int

Returns:

0-based row of the first cell or -1 if none.
getRow1
()

Returns the row (0 based) of the first cell, or -1 if there is no bottom-right anchor cell.

public int

Returns:

0-based row of the second cell or -1 if none.
getRow2
()

Returns the row (0 based) of the second cell, or -1 if there is no bottom-right anchor cell.

public void
setAnchorType(ClientAnchor.AnchorType
the anchor type to set
anchorType
)

Sets the anchor type

public void
setCol1(int
0-based column of the first cell.
col1
)

Sets the column (0 based) of the first cell.

public void
setCol2(int
0-based column of the second cell.
col2
)

Returns the column (0 based) of the second cell.

public void
setDx1(int
the x coordinate within the first cell
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 org.apache.poi.util.Units#EMU_PER_PIXEL

public void
setDx2(int
the x coordinate within the second cell
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 org.apache.poi.util.Units#EMU_PER_PIXEL

public void
setDy1(int
the y coordinate within the first cell
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 org.apache.poi.util.Units#EMU_PER_PIXEL

public void
setDy2(int
the y coordinate within the second cell
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 org.apache.poi.util.Units#EMU_PER_PIXEL

public void
setRow1(int
0-based row of the first cell.
row1
)

Returns the row (0 based) of the first cell.

public void
setRow2(int
0-based row of the first cell.
row2
)

Returns the row (0 based) of the first cell.

Method Detail

getAnchorTypeback to summary
public ClientAnchor.AnchorType getAnchorType()

Gets the anchor type Changed from returning an int to an enum in POI 3.14 beta 1.

Returns:ClientAnchor.AnchorType

the anchor type

getCol1back to summary
public short getCol1()

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 AnchorType#MOVE_AND_RESIZE

Returns:short

0-based column of the first cell or -1 if none.

getCol2back to summary
public short getCol2()

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 (AnchorType#DONT_MOVE_AND_RESIZE) and absolute sizing (AnchorType#MOVE_DONT_RESIZE.

Returns:short

0-based column of the second cell or -1 if none.

getDx1back to summary
public int getDx1()

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 org.apache.poi.util.Units#EMU_PER_PIXEL

Returns:int

the x coordinate within the first cell

getDx2back to summary
public 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 org.apache.poi.util.Units#EMU_PER_PIXEL

Returns:int

the x coordinate within the second cell

getDy1back to summary
public 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 org.apache.poi.util.Units#EMU_PER_PIXEL

Returns:int

the y coordinate within the first cell

getDy2back to summary
public 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 org.apache.poi.util.Units#EMU_PER_PIXEL

Returns:int

the y coordinate within the second cell

getRow1back to summary
public int getRow1()

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 (AnchorType#DONT_MOVE_AND_RESIZE).

Returns:int

0-based row of the first cell or -1 if none.

getRow2back to summary
public int getRow2()

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 (AnchorType#DONT_MOVE_AND_RESIZE) and absolute sizing (AnchorType#MOVE_DONT_RESIZE.

Returns:int

0-based row of the second cell or -1 if none.

setAnchorTypeback to summary
public void setAnchorType(ClientAnchor.AnchorType anchorType)

Sets the anchor type

Parameters
anchorType:ClientAnchor.AnchorType

the anchor type to set

Since
POI 3.14
setCol1back to summary
public void setCol1(int col1)

Sets the column (0 based) of the first cell.

Parameters
col1:int

0-based column of the first cell.

setCol2back to summary
public void setCol2(int col2)

Returns the column (0 based) of the second cell.

Parameters
col2:int

0-based column of the second cell.

setDx1back to summary
public 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 org.apache.poi.util.Units#EMU_PER_PIXEL

Parameters
dx1:int

the x coordinate within the first cell

setDx2back to summary
public 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 org.apache.poi.util.Units#EMU_PER_PIXEL

Parameters
dx2:int

the x coordinate within the second cell

setDy1back to summary
public 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 org.apache.poi.util.Units#EMU_PER_PIXEL

Parameters
dy1:int

the y coordinate within the first cell

setDy2back to summary
public 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 org.apache.poi.util.Units#EMU_PER_PIXEL

Parameters
dy2:int

the y coordinate within the second cell

setRow1back to summary
public void setRow1(int row1)

Returns the row (0 based) of the first cell.

Parameters
row1:int

0-based row of the first cell.

setRow2back to summary
public void setRow2(int row2)

Returns the row (0 based) of the first cell.

Parameters
row2:int

0-based row of the first cell.

org.apache.poi.ss.usermodel back to summary

public final Enum ClientAnchor.AnchorType

extends Enum<ClientAnchor.AnchorType>
Class Inheritance

Since
POI 3.14beta1

Field Summary

Modifier and TypeField and Description
public static final ClientAnchor.AnchorType
DONT_MOVE_AND_RESIZE

Do Not Move or Resize With Underlying Rows/Columns (3)

Specifies that the current start and end positions shall be maintained with respect to the distances from the absolute start point of the worksheet.

public static final ClientAnchor.AnchorType
DONT_MOVE_DO_RESIZE

Don't Move but do Resize With Anchor Cells (1)

Specifies that the current drawing shall not move with its row and column, but should be resized.

public static final ClientAnchor.AnchorType
MOVE_AND_RESIZE

Move and Resize With Anchor Cells (0)

Specifies that the current drawing shall move and resize to maintain its row and column anchors (i.e. the object is anchored to the actual from and to row and column)

public static final ClientAnchor.AnchorType
MOVE_DONT_RESIZE

Move With Cells but Do Not Resize (2)

Specifies that the current drawing shall move with its row and column (i.e. the object is anchored to the actual from row and column), but that the size shall remain absolute.

public final short

Constructor Summary

AccessConstructor and Description
private
AnchorType(int value)

Method Summary

Modifier and TypeMethod and Description
public static ClientAnchor.AnchorType

Returns:

the anchor type enum
byId
(int
the anchor type code
value
)

return the AnchorType corresponding to the code

public static ClientAnchor.AnchorType
public static ClientAnchor.AnchorType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DONT_MOVE_AND_RESIZEback to summary
public static final ClientAnchor.AnchorType DONT_MOVE_AND_RESIZE

Do Not Move or Resize With Underlying Rows/Columns (3)

Specifies that the current start and end positions shall be maintained with respect to the distances from the absolute start point of the worksheet.

If additional rows/columns are added before the drawing, the drawing shall move its anchors as needed to maintain this same absolute position.

DONT_MOVE_DO_RESIZEback to summary
public static final ClientAnchor.AnchorType DONT_MOVE_DO_RESIZE

Don't Move but do Resize With Anchor Cells (1)

Specifies that the current drawing shall not move with its row and column, but should be resized. This option is not normally used, but is included for completeness.

Note: Excel has no setting for this combination, nor does the ECMA standard.
MOVE_AND_RESIZEback to summary
public static final ClientAnchor.AnchorType MOVE_AND_RESIZE

Move and Resize With Anchor Cells (0)

Specifies that the current drawing shall move and resize to maintain its row and column anchors (i.e. the object is anchored to the actual from and to row and column)

MOVE_DONT_RESIZEback to summary
public static final ClientAnchor.AnchorType MOVE_DONT_RESIZE

Move With Cells but Do Not Resize (2)

Specifies that the current drawing shall move with its row and column (i.e. the object is anchored to the actual from row and column), but that the size shall remain absolute.

If additional rows/columns are added between the from and to locations of the drawing, the drawing shall move its to anchors as needed to maintain this same absolute size.

valueback to summary
public final short value

Constructor Detail

AnchorTypeback to summary
private AnchorType(int value)

Method Detail

byIdback to summary
public static ClientAnchor.AnchorType byId(int value)

return the AnchorType corresponding to the code

Parameters
value:int

the anchor type code

Returns:ClientAnchor.AnchorType

the anchor type enum

Annotations
@Internal
valueOfback to summary
public static ClientAnchor.AnchorType valueOf(String name)
valuesback to summary
public static ClientAnchor.AnchorType[] values()