Top Description Fields Constructors Methods
org.apache.poi.hssf.usermodel

public final Class HSSFClientAnchor

extends HSSFAnchor
implements ClientAnchor
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.usermodel.ClientAnchor
Imports
org.apache.poi.ddf.EscherClientAnchorRecord, .EscherRecord, org.apache.poi.ss.SpreadsheetVersion, org.apache.poi.ss.usermodel.ClientAnchor

A client anchor is attached to an excel worksheet. It anchors against a top-left and buttom-right cell.

Field Summary

Modifier and TypeField and Description
private EscherClientAnchorRecord
public static final int
public static final int
Inherited from org.apache.poi.hssf.usermodel.HSSFAnchor:
_isHorizontallyFlipped_isVerticallyFlipped

Constructor Summary

AccessConstructor and Description
public
HSSFClientAnchor(EscherClientAnchorRecord escherClientAnchorRecord)

public
HSSFClientAnchor()

Creates a new client anchor and defaults all the anchor positions to 0.

public
HSSFClientAnchor(int
the x coordinate within the first cell.
dx1
,
int
the y coordinate within the first cell.
dy1
,
int
the x coordinate within the second cell.
dx2
,
int
the y coordinate within the second cell.
dy2
,
short
the column (0 based) of the first cell.
col1
,
int
the row (0 based) of the first cell.
row1
,
short
the column (0 based) of the second cell.
col2
,
int
the row (0 based) of the second cell.
row2
)

Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor.

Method Summary

Modifier and TypeMethod and Description
private void
checkRange(int value, int minRange, int maxRange, String varName)

protected void
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public float

Returns:

the shape height.
getAnchorHeightInPoints
(HSSFSheet
the sheet the anchor will be attached to
sheet
)

Calculates the height of a client anchor in points.

public ClientAnchor.AnchorType

Returns:

the anchor type
getAnchorType
()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getAnchorType.

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

public short

Returns:

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

Implements org.apache.poi.ss.usermodel.ClientAnchor.getCol1.

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

public short

Returns:

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

Implements org.apache.poi.ss.usermodel.ClientAnchor.getCol2.

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

public int
public int
getDx2()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getDx2, org.apache.poi.ss.usermodel.ChildAnchor.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
getDy1()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getDy1, org.apache.poi.ss.usermodel.ChildAnchor.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
getDy2()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getDy2, org.apache.poi.ss.usermodel.ChildAnchor.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

protected EscherRecord
public int

Returns:

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

Implements org.apache.poi.ss.usermodel.ClientAnchor.getRow1.

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

public int

Returns:

the row(0 based) of the second cell.
getRow2
()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getRow2.

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

private float
getRowHeightInPoints(HSSFSheet sheet, int rowNum)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
public boolean
public void
setAnchor(short
the column (0 based) of the first cell.
col1
,
int
the row (0 based) of the first cell.
row1
,
int
the x coordinate within the first cell.
x1
,
int
the y coordinate within the first cell.
y1
,
short
the column (0 based) of the second cell.
col2
,
int
the row (0 based) of the second cell.
row2
,
int
the x coordinate within the second cell.
x2
,
int
the y coordinate within the second cell.
y2
)

Sets the top-left and bottom-right coordinates of the anchor.

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

Implements org.apache.poi.ss.usermodel.ClientAnchor.setAnchorType.

Sets the anchor type

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

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

Implements org.apache.poi.ss.usermodel.ClientAnchor.setCol1.

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

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

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

Implements org.apache.poi.ss.usermodel.ClientAnchor.setCol2.

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

public void
setDx1(int
the x coordinate within the first cell
dx1
)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setDx1, org.apache.poi.ss.usermodel.ChildAnchor.setDx1.

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
)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setDx2, org.apache.poi.ss.usermodel.ChildAnchor.setDx2.

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
)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setDy1, org.apache.poi.ss.usermodel.ChildAnchor.setDy1.

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
)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setDy2, org.apache.poi.ss.usermodel.ChildAnchor.setDy2.

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
)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setRow1.

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

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

Implements org.apache.poi.ss.usermodel.ClientAnchor.setRow2.

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

private static int

Returns:

The value represented by s.
unsignedValue
(final short
A 16-bit value intended to be interpreted as an unsigned integer.
s
)

Given a 16-bit unsigned integer stored in a short, return the unsigned value.

Inherited from org.apache.poi.hssf.usermodel.HSSFAnchor:
createAnchorFromEscher

Field Detail

_escherClientAnchorback to summary
private EscherClientAnchorRecord _escherClientAnchor
MAX_COLback to summary
public static final int MAX_COL
MAX_ROWback to summary
public static final int MAX_ROW

Constructor Detail

HSSFClientAnchorback to summary
public HSSFClientAnchor(EscherClientAnchorRecord escherClientAnchorRecord)
HSSFClientAnchorback to summary
public HSSFClientAnchor()

Creates a new client anchor and defaults all the anchor positions to 0.

HSSFClientAnchorback to summary
public HSSFClientAnchor(int dx1, int dy1, int dx2, int dy2, short col1, int row1, short col2, int row2)

Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor.

Note

Microsoft Excel seems to sometimes disallow higher y1 than y2 or higher x1 than x2, you might need to reverse them and draw shapes vertically or horizontally flipped!

Parameters
dx1:int

the x coordinate within the first cell.

dy1:int

the y coordinate within the first cell.

dx2:int

the x coordinate within the second cell.

dy2:int

the y coordinate within the second cell.

col1:short

the column (0 based) of the first cell.

row1:int

the row (0 based) of the first cell.

col2:short

the column (0 based) of the second cell.

row2:int

the row (0 based) of the second cell.

Method Detail

checkRangeback to summary
private void checkRange(int value, int minRange, int maxRange, String varName)
createEscherAnchorback to summary
protected void createEscherAnchor()

Implements abstract org.apache.poi.hssf.usermodel.HSSFAnchor.createEscherAnchor.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAnchorHeightInPointsback to summary
public float getAnchorHeightInPoints(HSSFSheet sheet)

Calculates the height of a client anchor in points.

Parameters
sheet:HSSFSheet

the sheet the anchor will be attached to

Returns:float

the shape height.

getAnchorTypeback to summary
public ClientAnchor.AnchorType getAnchorType()

Implements org.apache.poi.ss.usermodel.ClientAnchor.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

Annotations
@Override
getCol1back to summary
public short getCol1()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getCol1.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.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

the column(0 based) of the first cell.

getCol2back to summary
public short getCol2()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getCol2.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.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

the column(0 based) of the first cell.

getDx1back to summary
public int getDx1()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getDx1, org.apache.poi.ss.usermodel.ChildAnchor.getDx1.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.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

Annotations
@Override
getDx2back to summary
public int getDx2()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getDx2, org.apache.poi.ss.usermodel.ChildAnchor.getDx2.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.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

Annotations
@Override
getDy1back to summary
public int getDy1()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getDy1, org.apache.poi.ss.usermodel.ChildAnchor.getDy1.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.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

Annotations
@Override
getDy2back to summary
public int getDy2()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getDy2, org.apache.poi.ss.usermodel.ChildAnchor.getDy2.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.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

Annotations
@Override
getEscherAnchorback to summary
protected EscherRecord getEscherAnchor()

Implements abstract org.apache.poi.hssf.usermodel.HSSFAnchor.getEscherAnchor.

Annotations
@Override
getRow1back to summary
public int getRow1()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getRow1.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.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

the row(0 based) of the first cell.

getRow2back to summary
public int getRow2()

Implements org.apache.poi.ss.usermodel.ClientAnchor.getRow2.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.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

the row(0 based) of the second cell.

getRowHeightInPointsback to summary
private float getRowHeightInPoints(HSSFSheet sheet, int rowNum)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isHorizontallyFlippedback to summary
public boolean isHorizontallyFlipped()

Implements abstract org.apache.poi.hssf.usermodel.HSSFAnchor.isHorizontallyFlipped.

Returns:boolean

Doc from org.apache.poi.hssf.usermodel.HSSFAnchor.isHorizontallyFlipped.

whether this shape is horizontally flipped

isVerticallyFlippedback to summary
public boolean isVerticallyFlipped()

Implements abstract org.apache.poi.hssf.usermodel.HSSFAnchor.isVerticallyFlipped.

Returns:boolean

Doc from org.apache.poi.hssf.usermodel.HSSFAnchor.isVerticallyFlipped.

whether this shape is vertically flipped

setAnchorback to summary
public void setAnchor(short col1, int row1, int x1, int y1, short col2, int row2, int x2, int y2)

Sets the top-left and bottom-right coordinates of the anchor.

Note

Microsoft Excel seems to sometimes disallow higher y1 than y2 or higher x1 than x2, you might need to reverse them and draw shapes vertically or horizontally flipped!

Parameters
col1:short

the column (0 based) of the first cell.

row1:int

the row (0 based) of the first cell.

x1:int

the x coordinate within the first cell.

y1:int

the y coordinate within the first cell.

col2:short

the column (0 based) of the second cell.

row2:int

the row (0 based) of the second cell.

x2:int

the x coordinate within the second cell.

y2:int

the y coordinate within the second cell.

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

Implements org.apache.poi.ss.usermodel.ClientAnchor.setAnchorType.

Sets the anchor type

Parameters
anchorType:ClientAnchor.AnchorType

the anchor type to set

Annotations
@Override
Since
POI 3.14
setCol1back to summary
public void setCol1(short col1)
Parameters
col1:short

the column(0 based) of the first cell.

setCol1back to summary
public void setCol1(int col1)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setCol1.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.setCol1.

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(short col2)
Parameters
col2:short

the column(0 based) of the second cell.

setCol2back to summary
public void setCol2(int col2)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setCol2.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.setCol2.

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

Parameters
col2:int

the column(0 based) of the second cell.

setDx1back to summary
public void setDx1(int dx1)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setDx1, org.apache.poi.ss.usermodel.ChildAnchor.setDx1.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.setDx1.

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

Annotations
@Override
setDx2back to summary
public void setDx2(int dx2)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setDx2, org.apache.poi.ss.usermodel.ChildAnchor.setDx2.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.setDx2.

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

Annotations
@Override
setDy1back to summary
public void setDy1(int dy1)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setDy1, org.apache.poi.ss.usermodel.ChildAnchor.setDy1.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.setDy1.

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

Annotations
@Override
setDy2back to summary
public void setDy2(int dy2)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setDy2, org.apache.poi.ss.usermodel.ChildAnchor.setDy2.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.setDy2.

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

Annotations
@Override
setRow1back to summary
public void setRow1(int row1)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setRow1.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.setRow1.

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)

Implements org.apache.poi.ss.usermodel.ClientAnchor.setRow2.

Doc from org.apache.poi.ss.usermodel.ClientAnchor.setRow2.

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

Parameters
row2:int

the row(0 based) of the second cell.

unsignedValueback to summary
private static int unsignedValue(final short s)

Given a 16-bit unsigned integer stored in a short, return the unsigned value.

Parameters
s:short

A 16-bit value intended to be interpreted as an unsigned integer.

Returns:int

The value represented by s.