FileDocCategorySizeDatePackage
NoteRecord.javaAPI DocApache Poi 3.0.16699Mon Jan 01 18:59:10 GMT 2007org.apache.poi.hssf.record

NoteRecord

public class NoteRecord extends Record
NOTE: Comment Associated with a Cell (1Ch)
author
Yegor Kozlov

Fields Summary
public static final short
sid
public static final short
NOTE_HIDDEN
Flag indicating that the comment is hidden (default)
public static final short
NOTE_VISIBLE
Flag indicating that the comment is visible
private short
field_1_row
private short
field_2_col
private short
field_3_flags
private short
field_4_shapeid
private String
field_5_author
Constructors Summary
public NoteRecord()
Construct a new NoteRecord and fill its data with the default values


                     
     
    
        field_5_author = "";
        field_3_flags = 0;
    
public NoteRecord(RecordInputStream in)
Constructs a NoteRecord and fills its fields from the supplied RecordInputStream.

param
in the stream to read from

        super(in);

    
Methods Summary
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)
Read the record data from the supplied RecordInputStream

        field_1_row = in.readShort();
        field_2_col = in.readShort();
        field_3_flags = in.readShort();
        field_4_shapeid = in.readShort();
        int length = in.readShort();
        byte[] bytes = in.readRemainder();
        field_5_author = new String(bytes, 1, length);
    
public java.lang.StringgetAuthor()
Name of the original comment author

return
the name of the original author of the comment

        return field_5_author;
    
public shortgetColumn()
Return the column that contains the comment

return
the column that contains the comment

        return field_2_col;
    
public shortgetFlags()
Options flags.

return
the options flag
see
NoteRecord.NOTE_VISIBLE
see
NoteRecord.NOTE_HIDDEN

        return field_3_flags;
    
public intgetRecordSize()
Size of record

        int retval = 4 + 2 + 2 + 2 + 2 + 2 + 1 + field_5_author.length() + 1;

        return retval;
    
public shortgetRow()
Return the row that contains the comment

return
the row that contains the comment

        return field_1_row;
    
public shortgetShapeId()
Object id for OBJ record that contains the comment

        return field_4_shapeid;
    
public shortgetSid()

return
id of this record.

        return sid;
    
public intserialize(int offset, byte[] data)
Serialize the record data into the supplied array of bytes

param
offset offset in the data
param
data the data to serialize into
return
size of the record

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));

        LittleEndian.putShort(data, 4 + offset , field_1_row);
        LittleEndian.putShort(data, 6 + offset , field_2_col);
        LittleEndian.putShort(data, 8 + offset , field_3_flags);
        LittleEndian.putShort(data, 10 + offset , field_4_shapeid);
        LittleEndian.putShort(data, 12 + offset , (short)field_5_author.length());

        byte[] str = field_5_author.getBytes();
        System.arraycopy(str, 0, data, 15 + offset, str.length);

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

param
author the name of the original author of the comment

        field_5_author = author;
    
public voidsetColumn(short col)
Specify the column that contains the comment

param
col the column that contains the comment

        field_2_col = col;
    
public voidsetFlags(short flags)
Options flag

param
flags the options flag
see
#NOTE_VISIBLE
see
#NOTE_HIDDEN

        field_3_flags = flags;
    
public voidsetRow(short row)
Specify the row that contains the comment

param
row the row that contains the comment

        field_1_row = row;
    
public voidsetShapeId(short id)
Object id for OBJ record that contains the comment

        field_4_shapeid = id;
    
public java.lang.StringtoString()
Convert this record to string. Used by BiffViewer and other utulities.

        StringBuffer buffer = new StringBuffer();

        buffer.append("[NOTE]\n");
        buffer.append("    .recordid = 0x" + Integer.toHexString( getSid() ) + ", size = " + getRecordSize() + "\n");
        buffer.append("    .row =     " + field_1_row + "\n");
        buffer.append("    .col =     " + field_2_col + "\n");
        buffer.append("    .flags =   " + field_3_flags + "\n");
        buffer.append("    .shapeid = " + field_4_shapeid + "\n");
        buffer.append("    .author =  " + field_5_author + "\n");
        buffer.append("[/NOTE]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)
Checks the sid matches the expected side for this record

param
id the expected sid.

        if (id != sid)
        {
            throw new RecordFormatException("Not a NoteRecord record");
        }