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

ColumnInfoRecord

public class ColumnInfoRecord extends Record
Title: ColumnInfo Record

Description: Defines with width and formatting for a range of columns

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

author
Andrew C. Oliver (acoliver at apache dot org)
version
2.0-pre

Fields Summary
public static final short
sid
private short
field_1_first_col
private short
field_2_last_col
private short
field_3_col_width
private short
field_4_xf_index
private short
field_5_options
private static final BitField
hidden
private static final BitField
outlevel
private static final BitField
collapsed
private short
field_6_reserved
Constructors Summary
public ColumnInfoRecord()


     
    
    
public ColumnInfoRecord(RecordInputStream in)
Constructs a ColumnInfo record and sets its fields appropriately

param
id id must be 0x7d 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()

        ColumnInfoRecord rec = new ColumnInfoRecord();
        rec.field_1_first_col = field_1_first_col;
        rec.field_2_last_col = field_2_last_col;
        rec.field_3_col_width = field_3_col_width;
        rec.field_4_xf_index = field_4_xf_index;
        rec.field_5_options = field_5_options;
        rec.field_6_reserved = field_6_reserved;
        return rec;
    
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

        field_1_first_col = in.readShort();
        field_2_last_col  = in.readShort();
        field_3_col_width = in.readShort();
        field_4_xf_index  = in.readShort();
        field_5_options   = in.readShort();
        field_6_reserved  = in.readShort();
    
public booleangetCollapsed()
get whether the cells are collapsed

return
wether the cells are collapsed
see
#setOptions(short)

        return collapsed.isSet(field_5_options);
    
public shortgetColumnWidth()
get the columns' width in 1/256 of a character width

return
column width

        return field_3_col_width;
    
public shortgetFirstColumn()
get the first column this record defines formatting info for

return
the first column index (0-based)

        return field_1_first_col;
    
public booleangetHidden()
get whether or not these cells are hidden

return
whether the cells are hidden.
see
#setOptions(short)

        return hidden.isSet(field_5_options);
    
public shortgetLastColumn()
get the last column this record defines formatting info for

return
the last column index (0-based)

        return field_2_last_col;
    
public shortgetOptions()
get the options bitfield - use the bitsetters instead

return
the bitfield raw value

        return field_5_options;
    
public shortgetOutlineLevel()
get the outline level for the cells

see
#setOptions(short)
return
outline level for the cells

        return outlevel.getShortValue(field_5_options);
    
public intgetRecordSize()

        return 16;
    
public shortgetSid()

        return sid;
    
public shortgetXFIndex()
get the columns' default format info

return
the extended format index
see
org.apache.poi.hssf.record.ExtendedFormatRecord

        return field_4_xf_index;
    
public intserialize(int offset, byte[] data)

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset, ( short ) 12);
        LittleEndian.putShort(data, 4 + offset, getFirstColumn());
        LittleEndian.putShort(data, 6 + offset, getLastColumn());
        LittleEndian.putShort(data, 8 + offset, getColumnWidth());
        LittleEndian.putShort(data, 10 + offset, getXFIndex());
        LittleEndian.putShort(data, 12 + offset, getOptions());
        LittleEndian.putShort(data, 14 + offset, field_6_reserved);   
        return getRecordSize();
    
public voidsetCollapsed(boolean iscollapsed)
set whether the cells are collapsed

param
iscollapsed - wether the cells are collapsed
see
#setOptions(short)

        field_5_options = collapsed.setShortBoolean(field_5_options,
                                                    iscollapsed);
    
public voidsetColumnWidth(short cw)
set the columns' width in 1/256 of a character width

param
cw - column width

        field_3_col_width = cw;
    
public voidsetFirstColumn(short fc)
set the first column this record defines formatting info for

param
fc - the first column index (0-based)

        field_1_first_col = fc;
    
public voidsetHidden(boolean ishidden)
set whether or not these cells are hidden

param
ishidden - whether the cells are hidden.
see
#setOptions(short)

        field_5_options = hidden.setShortBoolean(field_5_options, ishidden);
    
public voidsetLastColumn(short lc)
set the last column this record defines formatting info for

param
lc - the last column index (0-based)

        field_2_last_col = lc;
    
public voidsetOptions(short options)
set the options bitfield - use the bitsetters instead

param
options - the bitfield raw value

        field_5_options = options;
    
public voidsetOutlineLevel(short olevel)
set the outline level for the cells

see
#setOptions(short)
param
olevel -outline level for the cells

        field_5_options = outlevel.setShortValue(field_5_options, olevel);
    
public voidsetXFIndex(short xfi)
set the columns' default format info

param
xfi - the extended format index
see
org.apache.poi.hssf.record.ExtendedFormatRecord

        field_4_xf_index = xfi;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("[COLINFO]\n");
        buffer.append("colfirst       = ").append(getFirstColumn())
            .append("\n");
        buffer.append("collast        = ").append(getLastColumn())
            .append("\n");
        buffer.append("colwidth       = ").append(getColumnWidth())
            .append("\n");
        buffer.append("xfindex        = ").append(getXFIndex()).append("\n");
        buffer.append("options        = ").append(getOptions()).append("\n");
        buffer.append("  hidden       = ").append(getHidden()).append("\n");
        buffer.append("  olevel       = ").append(getOutlineLevel())
            .append("\n");
        buffer.append("  collapsed    = ").append(getCollapsed())
            .append("\n");
        buffer.append("[/COLINFO]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)

        if (id != sid)
        {
            throw new RecordFormatException("NOT A COLINFO RECORD!!");
        }