Package 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
A client anchor is attached to an excel worksheet. It anchors against:
- A fixed position and fixed size
- A position relative to a cell (top-left) and a fixed size
- A position relative to a cell (top-left) and sized relative to another cell (bottom right)
ClientAnchor.AnchorType.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.poi.ss.usermodel.ClientAnchor
ClientAnchor.AnchorType -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates 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.protectedXSSFClientAnchor(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.protectedXSSFClientAnchor(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.protectedXSSFClientAnchor(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. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the anchor type Changed from returning an int to an enum in POI 3.14 beta 1.shortgetCol1()shortgetCol2()intgetDx1()intgetDx2()intgetDy1()intgetDy2()org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarkergetFrom()Return starting anchor pointorg.openxmlformats.schemas.drawingml.x2006.main.CTPoint2DintgetRow1()intgetRow2()org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2DgetSize()org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarkergetTo()Return ending anchor pointinthashCode()booleanisSet()voidsetAnchorType(ClientAnchor.AnchorType anchorType) Sets the anchor typevoidsetCol1(int col1) voidsetCol2(int col2) voidsetDx1(int dx1) voidsetDx2(int dx2) voidsetDy1(int dy1) voidsetDy2(int dy2) protected voidsetFrom(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker from) voidsetPosition(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D position) Sets the top-left absolute position of the object.voidsetRow1(int row1) voidsetRow2(int row2) voidsetSize(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D size) Sets the size of the object.protected voidsetTo(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker to) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.poi.ss.usermodel.ClientAnchor
setCol1, setCol2
-
Constructor Details
-
XSSFClientAnchor
public XSSFClientAnchor()Creates a new client anchor and defaults all the anchor positions to 0. Sets the type toClientAnchor.AnchorType.MOVE_AND_RESIZErelative 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 toClientAnchor.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 toClientAnchor.AnchorType.MOVE_AND_RESIZE.- Parameters:
cell1- starting anchor pointcell2- 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 toClientAnchor.AnchorType.MOVE_DONT_RESIZE.- Parameters:
sheet- needed to calculate ending point based on column/row sizescell1- starting anchor pointsize- 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 toClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE.- Parameters:
sheet- needed to calculate starting and ending points based on column/row sizesposition- starting absolute positionsize- object size, to calculate ending position
-
-
Method Details
-
getCol1
public short getCol1()- Specified by:
getCol1in interfaceClientAnchor
-
setCol1
public void setCol1(int col1) - Specified by:
setCol1in interfaceClientAnchor- Throws:
NullPointerException- if cell1 is null (fixed position)
-
getCol2
public short getCol2()- Specified by:
getCol2in interfaceClientAnchor
-
setCol2
public void setCol2(int col2) - Specified by:
setCol2in interfaceClientAnchor- Throws:
NullPointerException- if cell2 is null (fixed size)
-
getRow1
public int getRow1()- Specified by:
getRow1in interfaceClientAnchor
-
setRow1
public void setRow1(int row1) - Specified by:
setRow1in interfaceClientAnchor- Throws:
NullPointerException- if cell1 is null (fixed position)
-
getRow2
public int getRow2()- Specified by:
getRow2in interfaceClientAnchor
-
setRow2
public void setRow2(int row2) - Specified by:
setRow2in interfaceClientAnchor- Throws:
NullPointerException- if cell2 is null (fixed size)
-
getDx1
public int getDx1()- Specified by:
getDx1in interfaceChildAnchor- Specified by:
getDx1in interfaceClientAnchor
-
setDx1
public void setDx1(int dx1) - Specified by:
setDx1in interfaceChildAnchor- Specified by:
setDx1in interfaceClientAnchor- Throws:
NullPointerException- if cell1 is null (fixed position)- See Also:
-
getDy1
public int getDy1()- Specified by:
getDy1in interfaceChildAnchor- Specified by:
getDy1in interfaceClientAnchor
-
setDy1
public void setDy1(int dy1) - Specified by:
setDy1in interfaceChildAnchor- Specified by:
setDy1in interfaceClientAnchor- Throws:
NullPointerException- if cell1 is null (fixed position)- See Also:
-
getDy2
public int getDy2()- Specified by:
getDy2in interfaceChildAnchor- Specified by:
getDy2in interfaceClientAnchor
-
setDy2
public void setDy2(int dy2) - Specified by:
setDy2in interfaceChildAnchor- Specified by:
setDy2in interfaceClientAnchor- Throws:
NullPointerException- if cell2 is null (fixed size)- See Also:
-
getDx2
public int getDx2()- Specified by:
getDx2in interfaceChildAnchor- Specified by:
getDx2in interfaceClientAnchor
-
setDx2
public void setDx2(int dx2) - Specified by:
setDx2in interfaceChildAnchor- Specified by:
setDx2in interfaceClientAnchor- Throws:
NullPointerException- if cell2 is null (fixed size)- See Also:
-
equals
-
hashCode
public int hashCode() -
toString
-
getFrom
Return starting anchor point- Returns:
- starting anchor point
-
setFrom
protected void setFrom(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker from) -
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:
- 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:
- 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:
- 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:
- 3.17 beta 1
-
setAnchorType
Sets the anchor type- Specified by:
setAnchorTypein interfaceClientAnchor- Parameters:
anchorType- the anchor type to set- Since:
- 3.14
-
getAnchorType
Gets the anchor type Changed from returning an int to an enum in POI 3.14 beta 1.- Specified by:
getAnchorTypein interfaceClientAnchor- Returns:
- the anchor type
-
isSet
public boolean isSet()
-