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

RecalcIdRecord

public class RecalcIdRecord extends Record
Title: Recalc Id Record

Description: This record contains an ID that marks when a worksheet was last recalculated. It's an optimization Excel uses to determine if it needs to recalculate the spreadsheet when it's opened. So far, only the two values 0xC1 0x01 0x00 0x00 0x80 0x38 0x01 0x00 (do not recalculate) and 0xC1 0x01 0x00 0x00 0x60 0x69 0x01 0x00 have been seen. If the field isNeeded is set to false (default), then this record is swallowed during the serialization process

REFERENCE: http://chicago.sourceforge.net/devel/docs/excel/biff8.html

author
Luc Girardin (luc dot girardin at macrofocus dot com)
version
2.0-pre
see
org.apache.poi.hssf.model.Workbook

Fields Summary
public static final short
sid
public short[]
field_1_recalcids
private boolean
isNeeded
Constructors Summary
public RecalcIdRecord()


     
    
    
public RecalcIdRecord(RecordInputStream in)
Constructs a RECALCID record and sets its fields appropriately.

param
id id must be 0x13d 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
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

        field_1_recalcids = new short[ in.remaining() / 2 ];
        for (int k = 0; k < field_1_recalcids.length; k++)
        {
            field_1_recalcids[ k ] = in.readShort();
        }
    
public short[]getRecalcIdArray()
get the recalc array.

return
array of recalc id's

        return field_1_recalcids;
    
public intgetRecordSize()

        return 4 + (getRecalcIdArray().length * 2);
    
public shortgetSid()

        return sid;
    
public booleanisNeeded()

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

        short[] tabids     = getRecalcIdArray();
        short   length     = ( short ) (tabids.length * 2);
        int     byteoffset = 4;

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset,
                              (( short ) length));

        // 2 (num bytes in a short)
        for (int k = 0; k < (length / 2); k++)
        {
            LittleEndian.putShort(data, byteoffset + offset, tabids[ k ]);
            byteoffset += 2;
        }
        return getRecordSize();
    
public voidsetIsNeeded(boolean isNeeded)

        this.isNeeded = isNeeded;
    
public voidsetRecalcIdArray(short[] array)
set the recalc array.

param
array of recalc id's

        field_1_recalcids = array;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("[RECALCID]\n");
        buffer.append("    .elements        = ").append(field_1_recalcids.length)
            .append("\n");
        for (int k = 0; k < field_1_recalcids.length; k++)
        {
            buffer.append("    .element_" + k + "       = ")
                .append(field_1_recalcids[ k ]).append("\n");
        }
        buffer.append("[/RECALCID]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)

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