FileDocCategorySizeDatePackage
HSSFComment.javaAPI DocApache Poi 3.0.14836Sun Mar 11 12:59:08 GMT 2007org.apache.poi.hssf.usermodel

HSSFComment

public class HSSFComment extends HSSFTextbox
Represents a cell comment - a sticky note associated with a cell.
author
Yegor Kozlov

Fields Summary
private boolean
visible
private short
col
private short
row
private String
author
private NoteRecord
note
private TextObjectRecord
txo
Constructors Summary
public HSSFComment(HSSFShape parent, HSSFAnchor anchor)
Construct a new comment with the given parent and anchor.

param
parent
param
anchor defines position of this anchor in the sheet


                                
          
    
        super( parent, anchor );
        setShapeType(OBJECT_TYPE_COMMENT);

        //default color for comments
        fillColor = 0x08000050;

        //by default comments are hidden
        visible = false;

        author = "";
    
protected HSSFComment(NoteRecord note, TextObjectRecord txo)

        this( (HSSFShape)null, (HSSFAnchor)null );
        this.txo = txo;
        this.note = note;
    
Methods Summary
public java.lang.StringgetAuthor()
Name of the original comment author

return
the name of the original author of the comment

        return author;
    
public shortgetColumn()
Return the column of the cell that contains the comment

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

        return col;
    
public intgetRow()
Return the row of the cell that contains the comment

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

        return row;
    
public booleanisVisible()
Sets whether this comment is visible.

return
true if the comment is visible, false otherwise

        return this.visible;
    
public voidsetAuthor(java.lang.String author)
Name of the original comment author

param
author the name of the original author of the comment

        if(note != null) note.setAuthor(author);
        this.author = author;
    
public voidsetColumn(short col)
Set the column of the cell that contains the comment

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

        if(note != null) note.setColumn(col);
        this.col = col;
    
public voidsetRow(int row)
Set the row of the cell that contains the comment

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

        if(note != null) note.setRow((short)row);
        this.row = (short)row;
    
public voidsetString(org.apache.poi.hssf.usermodel.HSSFRichTextString string)
Sets the rich text string used by this comment.

param
string Sets the rich text string used by this object.

        //if font is not set we must set the default one
        if (string.numFormattingRuns() == 0) string.applyFont((short)0);

        if (txo != null) {
            int frLength = ( string.numFormattingRuns() + 1 ) * 8;
            txo.setFormattingRunLength( (short) frLength );
            txo.setTextLength( (short) string.length() );
            txo.setStr( string );
        }
        super.setString(string);
    
public voidsetVisible(boolean visible)
Returns whether this comment is visible.

param
visible true if the comment is visible, false otherwise

        if(note != null) note.setFlags(visible ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN);
        this.visible = visible;