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

DimensionsRecord

public class DimensionsRecord extends Record
Title: Dimensions Record

Description: provides the minumum and maximum bounds of a sheet.

REFERENCE: PG 303 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

Fields Summary
public static final short
sid
private int
field_1_first_row
private int
field_2_last_row
private short
field_3_first_col
private short
field_4_last_col
private short
field_5_zero
Constructors Summary
public DimensionsRecord()

       // must be 0 (reserved)

     
    
    
public DimensionsRecord(RecordInputStream in)
Constructs a Dimensions record and sets its fields appropriately.

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

      DimensionsRecord rec = new DimensionsRecord();
      rec.field_1_first_row = field_1_first_row;
      rec.field_2_last_row = field_2_last_row;
      rec.field_3_first_col = field_3_first_col;
      rec.field_4_last_col = field_4_last_col;
      rec.field_5_zero = field_5_zero;
      return rec;
    
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

        field_1_first_row = in.readInt();
        field_2_last_row  = in.readInt();
        field_3_first_col = in.readShort();
        field_4_last_col  = in.readShort();
        field_5_zero      = in.readShort();
    
public shortgetFirstCol()
get the first column number for the sheet

return
column - first column on the sheet

        return field_3_first_col;
    
public intgetFirstRow()
get the first row number for the sheet

return
row - first row on the sheet

        return field_1_first_row;
    
public shortgetLastCol()
get the last col number for the sheet

return
column - last column on the sheet

        return field_4_last_col;
    
public intgetLastRow()
get the last row number for the sheet

return
row - last row on the sheet

        return field_2_last_row;
    
public intgetRecordSize()

        return 18;
    
public shortgetSid()

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

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset, ( short ) 14);
        LittleEndian.putInt(data, 4 + offset, getFirstRow());
        LittleEndian.putInt(data, 8 + offset, getLastRow());
        LittleEndian.putShort(data, 12 + offset, getFirstCol());
        LittleEndian.putShort(data, 14 + offset, getLastCol());
        LittleEndian.putShort(data, 16 + offset, ( short ) 0);
        return getRecordSize();
    
public voidsetFirstCol(short col)
set the first column number for the sheet

param
col first column on the sheet

        field_3_first_col = col;
    
public voidsetFirstRow(int row)
set the first row number for the sheet

param
row - first row on the sheet

        field_1_first_row = row;
    
public voidsetLastCol(short col)
set the last col number for the sheet

param
col last column on the sheet

        field_4_last_col = col;
    
public voidsetLastRow(int row)
set the last row number for the sheet

param
row - last row on the sheet

        field_2_last_row = row;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("[DIMENSIONS]\n");
        buffer.append("    .firstrow       = ")
            .append(Integer.toHexString(getFirstRow())).append("\n");
        buffer.append("    .lastrow        = ")
            .append(Integer.toHexString(getLastRow())).append("\n");
        buffer.append("    .firstcol       = ")
            .append(Integer.toHexString(getFirstCol())).append("\n");
        buffer.append("    .lastcol        = ")
            .append(Integer.toHexString(getLastCol())).append("\n");
        buffer.append("    .zero           = ")
            .append(Integer.toHexString(field_5_zero)).append("\n");
        buffer.append("[/DIMENSIONS]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)

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