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

public Class HSSFComment

extends HSSFTextbox
implements Comment
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.usermodel.Comment
Imports
java.util.Objects, org.apache.poi.ddf.DefaultEscherRecordFactory, .EscherBSERecord, .EscherContainerRecord, .EscherOptRecord, .EscherPropertyTypes, .EscherSimpleProperty, org.apache.poi.hssf.record.CommonObjectDataSubRecord, .EndSubRecord, .NoteRecord, .NoteStructureSubRecord, .ObjRecord, .TextObjectRecord, org.apache.poi.ss.usermodel.ClientAnchor, .Comment, org.apache.poi.ss.util.CellAddress

Represents a cell comment - a sticky note associated with a cell.

Field Summary

Modifier and TypeField and Description
private final NoteRecord
private static final int
private static final int
private static final int
private static final int
private static final int
Inherited from org.apache.poi.hssf.usermodel.HSSFTextbox:
HORIZONTAL_ALIGNMENT_CENTEREDHORIZONTAL_ALIGNMENT_DISTRIBUTEDHORIZONTAL_ALIGNMENT_JUSTIFIEDHORIZONTAL_ALIGNMENT_LEFTHORIZONTAL_ALIGNMENT_RIGHTOBJECT_TYPE_TEXTVERTICAL_ALIGNMENT_BOTTOMVERTICAL_ALIGNMENT_CENTERVERTICAL_ALIGNMENT_DISTRIBUTEDVERTICAL_ALIGNMENT_JUSTIFYVERTICAL_ALIGNMENT_TOP

Constructor Summary

AccessConstructor and Description
public
HSSFComment(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord textObjectRecord, NoteRecord note)

public
HSSFComment(HSSFShape parent, HSSFAnchor
defines position of this anchor in the sheet
anchor
)

Construct a new comment with the given parent and anchor.

private
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public void
afterRemove(HSSFPatriarch patriarch)

Overrides org.apache.poi.hssf.usermodel.HSSFTextbox.afterRemove.

remove escher container from the patriarch.escherAggregate remove obj, textObj and note records if it's necessary in case of ShapeGroup remove all contained shapes

protected HSSFShape
private static NoteRecord
protected ObjRecord
protected EscherContainerRecord
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 CellAddress
getAddress()

Implements org.apache.poi.ss.usermodel.Comment.getAddress.

Get the address of the cell that this comment is attached to

public String

Returns:

the name of the original author of the comment
getAuthor
()

Implements org.apache.poi.ss.usermodel.Comment.getAuthor.

Name of the original comment author

public int
public ClientAnchor
getClientAnchor()

Implements org.apache.poi.ss.usermodel.Comment.getClientAnchor.

Return defined position of this anchor in the sheet.

public int

Returns:

the 0-based column of the cell that contains the comment
getColumn
()

Implements org.apache.poi.ss.usermodel.Comment.getColumn.

Return the column of the cell that contains the comment

protected NoteRecord
getNoteRecord()

Returns the underlying Note record

public int

Returns:

the 0-based row of the cell that contains the comment
getRow
()

Implements org.apache.poi.ss.usermodel.Comment.getRow.

Return the row of the cell that contains the comment

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
hasPosition()

Do we know which cell this comment belongs to?

public boolean

Returns:

true if the comment is visible, false otherwise
isVisible
()

Implements org.apache.poi.ss.usermodel.Comment.isVisible.

Returns whether this comment is visible.

public void
public void
setAddress(CellAddress address)

Implements org.apache.poi.ss.usermodel.Comment.setAddress.

Set the address of the cell that this comment is attached to

public void
setAddress(int row, int col)

Implements org.apache.poi.ss.usermodel.Comment.setAddress.

Set the address of the cell that this comment is attached to

public void
setAuthor(String
the name of the original author of the comment
author
)

Implements org.apache.poi.ss.usermodel.Comment.setAuthor.

Name of the original comment author

public void
setBackgroundImage(int pictureIndex)

public void
setColumn(int
the 0-based column of the cell that contains the comment
col
)

Implements org.apache.poi.ss.usermodel.Comment.setColumn.

Set the column of the cell that contains the comment

private void
setHidden(boolean value)

public void
setRow(int
the 0-based row of the cell that contains the comment
row
)

Implements org.apache.poi.ss.usermodel.Comment.setRow.

Set the row of the cell that contains the comment

pack-priv void
setShapeId(int
- global shapeId which must be set to EscherSpRecord
shapeId
)

Overrides org.apache.poi.hssf.usermodel.HSSFShape.setShapeId.

public void
public void
setVisible(boolean
true if the comment is visible, false otherwise
visible
)

Implements org.apache.poi.ss.usermodel.Comment.setVisible.

Sets whether this comment is visible.

Inherited from org.apache.poi.hssf.usermodel.HSSFTextbox:
getHorizontalAlignmentgetMarginBottomgetMarginLeftgetMarginRightgetMarginTopgetVerticalAlignmentsetHorizontalAlignmentsetMarginBottomsetMarginLeftsetMarginRightsetMarginTopsetVerticalAlignment

Field Detail

_noteback to summary
private final NoteRecord _note
FILL_TYPE_PICTUREback to summary
private static final int FILL_TYPE_PICTURE
FILL_TYPE_SOLIDback to summary
private static final int FILL_TYPE_SOLID
GROUP_SHAPE_HIDDEN_MASKback to summary
private static final int GROUP_SHAPE_HIDDEN_MASK
GROUP_SHAPE_NOT_HIDDEN_MASKback to summary
private static final int GROUP_SHAPE_NOT_HIDDEN_MASK
GROUP_SHAPE_PROPERTY_DEFAULT_VALUEback to summary
private static final int GROUP_SHAPE_PROPERTY_DEFAULT_VALUE

Constructor Detail

HSSFCommentback to summary
public HSSFComment(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord textObjectRecord, NoteRecord note)
HSSFCommentback to summary
public HSSFComment(HSSFShape parent, HSSFAnchor anchor)

Construct a new comment with the given parent and anchor.

Parameters
anchor:HSSFAnchor

defines position of this anchor in the sheet

HSSFCommentback to summary
private HSSFComment(HSSFShape parent, HSSFAnchor anchor, NoteRecord note)
HSSFCommentback to summary
protected HSSFComment(NoteRecord note, TextObjectRecord txo)

Method Detail

afterInsertback to summary
pack-priv void afterInsert(HSSFPatriarch patriarch)

Overrides org.apache.poi.hssf.usermodel.HSSFTextbox.afterInsert.

Annotations
@Override
afterRemoveback to summary
public void afterRemove(HSSFPatriarch patriarch)

Overrides org.apache.poi.hssf.usermodel.HSSFTextbox.afterRemove.

Doc from org.apache.poi.hssf.usermodel.HSSFShape.afterRemove.

remove escher container from the patriarch.escherAggregate remove obj, textObj and note records if it's necessary in case of ShapeGroup remove all contained shapes

Annotations
@Override
cloneShapeback to summary
protected HSSFShape cloneShape()

Overrides org.apache.poi.hssf.usermodel.HSSFTextbox.cloneShape.

Annotations
@Override
createNoteRecordback to summary
private static NoteRecord createNoteRecord()
createObjRecordback to summary
protected ObjRecord createObjRecord()

Overrides org.apache.poi.hssf.usermodel.HSSFTextbox.createObjRecord.

Annotations
@Override
createSpContainerback to summary
protected EscherContainerRecord createSpContainer()

Overrides org.apache.poi.hssf.usermodel.HSSFTextbox.createSpContainer.

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
getAddressback to summary
public CellAddress getAddress()

Implements org.apache.poi.ss.usermodel.Comment.getAddress.

Doc from org.apache.poi.ss.usermodel.Comment.getAddress.

Get the address of the cell that this comment is attached to

Returns:CellAddress

comment cell address

Annotations
@Override
getAuthorback to summary
public String getAuthor()

Implements org.apache.poi.ss.usermodel.Comment.getAuthor.

Name of the original comment author

Returns:String

the name of the original author of the comment

Annotations
@Override
getBackgroundImageIdback to summary
public int getBackgroundImageId()
getClientAnchorback to summary
public ClientAnchor getClientAnchor()

Implements org.apache.poi.ss.usermodel.Comment.getClientAnchor.

Doc from org.apache.poi.ss.usermodel.Comment.getClientAnchor.

Return defined position of this anchor in the sheet. The anchor is the yellow box/balloon that is rendered on top of the sheets when the comment is visible. To associate a comment with a different cell, use setAddress.

Returns:ClientAnchor

defined position of this anchor in the sheet, can be null

Annotations
@Override
getColumnback to summary
public int getColumn()

Implements org.apache.poi.ss.usermodel.Comment.getColumn.

Return the column of the cell that contains the comment

Returns:int

the 0-based column of the cell that contains the comment

Annotations
@Override
getNoteRecordback to summary
protected NoteRecord getNoteRecord()

Returns the underlying Note record

getRowback to summary
public int getRow()

Implements org.apache.poi.ss.usermodel.Comment.getRow.

Return the row of the cell that contains the comment

Returns:int

the 0-based row of the cell that contains the comment

Annotations
@Override
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
hasPositionback to summary
public boolean hasPosition()

Do we know which cell this comment belongs to?

isVisibleback to summary
public boolean isVisible()

Implements org.apache.poi.ss.usermodel.Comment.isVisible.

Returns whether this comment is visible.

Returns:boolean

true if the comment is visible, false otherwise

Annotations
@Override
resetBackgroundImageback to summary
public void resetBackgroundImage()
setAddressback to summary
public void setAddress(CellAddress address)

Implements org.apache.poi.ss.usermodel.Comment.setAddress.

Doc from org.apache.poi.ss.usermodel.Comment.setAddress.

Set the address of the cell that this comment is attached to

Annotations
@Override
setAddressback to summary
public void setAddress(int row, int col)

Implements org.apache.poi.ss.usermodel.Comment.setAddress.

Doc from org.apache.poi.ss.usermodel.Comment.setAddress.

Set the address of the cell that this comment is attached to

Annotations
@Override
setAuthorback to summary
public void setAuthor(String author)

Implements org.apache.poi.ss.usermodel.Comment.setAuthor.

Name of the original comment author

Parameters
author:String

the name of the original author of the comment

Annotations
@Override
setBackgroundImageback to summary
public void setBackgroundImage(int pictureIndex)
setColumnback to summary
public void setColumn(int col)

Implements org.apache.poi.ss.usermodel.Comment.setColumn.

Set the column of the cell that contains the comment

Parameters
col:int

the 0-based column of the cell that contains the comment

Annotations
@Override
setHiddenback to summary
private void setHidden(boolean value)
setRowback to summary
public void setRow(int row)

Implements org.apache.poi.ss.usermodel.Comment.setRow.

Set the row of the cell that contains the comment

Parameters
row:int

the 0-based row of the cell that contains the comment

Annotations
@Override
setShapeIdback to summary
pack-priv void setShapeId(int shapeId)

Overrides org.apache.poi.hssf.usermodel.HSSFShape.setShapeId.

Parameters
shapeId:int

Doc from org.apache.poi.hssf.usermodel.HSSFShape.setShapeId.

- global shapeId which must be set to EscherSpRecord

Annotations
@Override
setShapeTypeback to summary
public void setShapeType(int shapeType)

Overrides org.apache.poi.hssf.usermodel.HSSFTextbox.setShapeType.

Parameters
shapeType:int

Doc from org.apache.poi.hssf.usermodel.HSSFSimpleShape.setShapeType.

- shapeType

Annotations
@Override
setVisibleback to summary
public void setVisible(boolean visible)

Implements org.apache.poi.ss.usermodel.Comment.setVisible.

Sets whether this comment is visible.

Parameters
visible:boolean

true if the comment is visible, false otherwise

Annotations
@Override