FileDocCategorySizeDatePackage
LabelRecord.javaAPI DocApache Poi 3.0.17920Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record

LabelRecord

public class LabelRecord extends Record implements CellValueRecordInterface
Label Record - read only support for strings stored directly in the cell.. Don't use this (except to read), use LabelSST instead

REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

author
Andrew C. Oliver (acoliver at apache dot org)
author
Jason Height (jheight at chariot dot net dot au)
version
2.0-pre
see
org.apache.poi.hssf.record.LabelSSTRecord

Fields Summary
public static final short
sid
private int
field_1_row
private short
field_2_column
private short
field_3_xf_index
private short
field_4_string_len
private byte
field_5_unicode_flag
private String
field_6_value
Constructors Summary
public LabelRecord()
Creates new LabelRecord


        

     
    
    
public LabelRecord(RecordInputStream in)
Constructs an Label record and sets its fields appropriately.

param
id id must be 0x204 or an exception will be throw upon validation
param
size the size of the data area of the record
param
data data of the record (should not contain sid/len)

        super(in);
    
Methods Summary
public java.lang.Objectclone()

      LabelRecord rec = new LabelRecord();
      rec.field_1_row = field_1_row;
      rec.field_2_column = field_2_column;
      rec.field_3_xf_index = field_3_xf_index;
      rec.field_4_string_len = field_4_string_len;
      rec.field_5_unicode_flag = field_5_unicode_flag;
      rec.field_6_value = field_6_value;
      return rec;
    
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)
called by the constructor, should set class level fields. Should throw runtime exception for bad/icomplete data.

param
data raw data
param
size size of data

        //field_1_row          = LittleEndian.getShort(data, 0 + offset);
        field_1_row          = in.readUShort();
        field_2_column       = in.readShort();
        field_3_xf_index     = in.readShort();
        field_4_string_len   = in.readShort();
        field_5_unicode_flag = in.readByte();
        if (field_4_string_len > 0) {
          if (isUnCompressedUnicode()) {
            field_6_value = in.readUnicodeLEString(field_4_string_len);
          } else {
            field_6_value = in.readCompressedUnicode(field_4_string_len);
        }
        } else field_6_value = null;
    
public shortgetColumn()

        return field_2_column;
    
public intgetRow()

        return field_1_row;
    
public shortgetSid()

        return sid;
    
public shortgetStringLength()
get the number of characters this string contains

return
number of characters

        return field_4_string_len;
    
public java.lang.StringgetValue()
get the value

return
the text string
see
#getStringLength()

        return field_6_value;
    
public shortgetXFIndex()

        return field_3_xf_index;
    
public booleanisAfter(org.apache.poi.hssf.record.CellValueRecordInterface i)

        if (this.getRow() < i.getRow())
        {
            return false;
        }
        if ((this.getRow() == i.getRow())
                && (this.getColumn() < i.getColumn()))
        {
            return false;
        }
        if ((this.getRow() == i.getRow())
                && (this.getColumn() == i.getColumn()))
        {
            return false;
        }
        return true;
    
public booleanisBefore(org.apache.poi.hssf.record.CellValueRecordInterface i)

        if (this.getRow() > i.getRow())
        {
            return false;
        }
        if ((this.getRow() == i.getRow())
                && (this.getColumn() > i.getColumn()))
        {
            return false;
        }
        if ((this.getRow() == i.getRow())
                && (this.getColumn() == i.getColumn()))
        {
            return false;
        }
        return true;
    
public booleanisEqual(org.apache.poi.hssf.record.CellValueRecordInterface i)

        return ((this.getRow() == i.getRow())
                && (this.getColumn() == i.getColumn()));
    
public booleanisInValueSection()

        return true;
    
public booleanisUnCompressedUnicode()
is this uncompressed unicode (16bit)? Or just 8-bit compressed?

return
isUnicode - True for 16bit- false for 8bit

        return (field_5_unicode_flag == 1);
    
public booleanisValue()

        return true;
    
public intserialize(int offset, byte[] data)
THROWS A RUNTIME EXCEPTION.. USE LABELSSTRecords. YOU HAVE NO REASON to use LABELRecord!!

        throw new RecordFormatException(
            "Label Records are supported READ ONLY...convert to LabelSST");
    
public voidsetColumn(short col)
NO-OP!

    
public voidsetRow(int row)
NO-OP!

    
public voidsetXFIndex(short xf)
no op!

    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();
        buffer.append("[LABEL]\n");
        buffer.append("    .row            = ")
            .append(Integer.toHexString(getRow())).append("\n");
        buffer.append("    .column         = ")
            .append(Integer.toHexString(getColumn())).append("\n");
        buffer.append("    .xfindex        = ")
            .append(Integer.toHexString(getXFIndex())).append("\n");
        buffer.append("    .string_len       = ")
            .append(Integer.toHexString(field_4_string_len)).append("\n");
        buffer.append("    .unicode_flag       = ")
            .append(Integer.toHexString(field_5_unicode_flag)).append("\n");
        buffer.append("    .value       = ")
            .append(getValue()).append("\n");
        buffer.append("[/LABEL]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)
called by constructor, should throw runtime exception in the event of a record passed with a differing ID.

param
id alleged id for this record

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