org.apache.poi.ss.usermodel
Interface ClientAnchor

All Known Implementing Classes:
HSSFClientAnchor, XSSFClientAnchor

public interface ClientAnchor

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 ClientAnchor.AnchorType:

  1. ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE == absolute top-left coordinates and width/height, no cell references
  2. ClientAnchor.AnchorType.MOVE_DONT_RESIZE == fixed top-left cell reference, absolute width/height
  3. ClientAnchor.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 Class Summary
static class ClientAnchor.AnchorType
           
 
Field Summary
static ClientAnchor.AnchorType DONT_MOVE_AND_RESIZE
          Deprecated. since POI 3.14beta1 (circa 2015-11-24). Use ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE instead.
static ClientAnchor.AnchorType MOVE_AND_RESIZE
          Deprecated. since POI 3.14beta1 (circa 2015-11-24). Use ClientAnchor.AnchorType.MOVE_AND_RESIZE instead.
static ClientAnchor.AnchorType MOVE_DONT_RESIZE
          Deprecated. since POI 3.14beta1 (circa 2015-11-24). Use ClientAnchor.AnchorType.MOVE_DONT_RESIZE instead.
 
Method Summary
 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
 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.
 void setAnchorType(ClientAnchor.AnchorType anchorType)
          Sets the anchor type
 void setAnchorType(int anchorType)
          Deprecated. POI 3.15. Use setAnchorType(AnchorType) instead.
 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 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.
 

Field Detail

MOVE_AND_RESIZE

@Removal(version="3.17")
static final ClientAnchor.AnchorType MOVE_AND_RESIZE
Deprecated. since POI 3.14beta1 (circa 2015-11-24). Use ClientAnchor.AnchorType.MOVE_AND_RESIZE instead.
Move and Resize With Anchor Cells

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_RESIZE

@Removal(version="3.17")
static final ClientAnchor.AnchorType MOVE_DONT_RESIZE
Deprecated. since POI 3.14beta1 (circa 2015-11-24). Use ClientAnchor.AnchorType.MOVE_DONT_RESIZE instead.
Move With Cells but Do Not Resize

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.


DONT_MOVE_AND_RESIZE

@Removal(version="3.17")
static final ClientAnchor.AnchorType DONT_MOVE_AND_RESIZE
Deprecated. since POI 3.14beta1 (circa 2015-11-24). Use ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE instead.
Do Not Move or Resize With Underlying Rows/Columns

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.

Method Detail

getCol1

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 (AnchorTypeDONT_MOVE_AND_RESIZE).

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

setCol1

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

Parameters:
col1 - 0-based column of the first cell.

getCol2

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

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

setCol2

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

Parameters:
col2 - 0-based column of the second cell.

getRow1

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

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

setRow1

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

Parameters:
row1 - 0-based row of the first cell.

getRow2

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

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

setRow2

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

Parameters:
row2 - 0-based row of the first cell.

getDx1

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 Units.EMU_PER_PIXEL

Returns:
the x coordinate within the first cell

setDx1

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

Parameters:
dx1 - the x coordinate within the first cell

getDy1

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

Returns:
the y coordinate within the first cell

setDy1

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

Parameters:
dy1 - the y coordinate within the first cell

getDy2

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

Returns:
the y coordinate within the second cell

setDy2

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

Parameters:
dy2 - the y coordinate within the second cell

getDx2

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

Returns:
the x coordinate within the second cell

setDx2

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

Parameters:
dx2 - the x coordinate within the second cell

setAnchorType

void setAnchorType(ClientAnchor.AnchorType anchorType)
Sets the anchor type

Parameters:
anchorType - the anchor type to set
Since:
POI 3.14

setAnchorType

@Removal(version="3.17")
void setAnchorType(int anchorType)
Deprecated. POI 3.15. Use setAnchorType(AnchorType) instead.

Sets the anchor type

Parameters:
anchorType - the anchor type to set

getAnchorType

ClientAnchor.AnchorType getAnchorType()
Gets the anchor type Changed from returning an int to an enum in POI 3.14 beta 1.

Returns:
the anchor type


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