## org.apache.poi.hssf.record
Class SharedFormulaRecord

    java.lang.Object
      org.apache.poi.hssf.record.Record
          org.apache.poi.hssf.record.SharedFormulaRecord

public class SharedFormulaRecord
extends Record

Title: SharedFormulaRecord Description: Primarily used as an excel optimization so that multiple similar formulas are not written out too many times. We should recognize this record and serialize as is since this is used when reading templates.

Note: the documentation says that the SID is BC where biffviewer reports 4BC. The hex dump shows that the two byte sid representation to be 'BC 04' that is consistent with the other high byte record types.

Author:
  Danny Mui at apache dot org

Field Summary
`static short` `sid`

Constructor Summary
`SharedFormulaRecord()`
`SharedFormulaRecord(short id, short size, byte[] data)` construct the sharedformula record, save all the information

Method Summary
`java.lang.Object` `clone()`
`protected void` `fillFields(byte[] data, short size, int offset)` Shared formulas are to treated like unknown records, and as a result d
`int` `getRecordSize()` gives the current serialized size of the record.
`short` `getSid()` return the non static version of the id for this record.
`boolean` `isInValueSection()` Mirroring formula records so it is registered in the ValueRecordsAggregate
`boolean` `isValue()` Register it in the ValueRecordsAggregate so it can go into the FormulaRecordAggregate
`int` `serialize(int offset, byte[] data)` spit the record out AS IS.
`java.lang.String` `toString()` print a sort of string representation ([SHARED FORMULA RECORD] id = x [/SHARED FORMULA RECORD])
`protected void` `validateSid(short id)` called by constructor, should throw runtime exception in the event of a record passed with a differing ID.

Methods inherited from class org.apache.poi.hssf.record.Record
`fillFields, processContinueRecord, serialize`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### sid

    public static final short sid

See Also:
  Constant Field Values

Constructor Detail

### SharedFormulaRecord

    public SharedFormulaRecord()

### SharedFormulaRecord

    public SharedFormulaRecord(short id,
                               short size,
                               byte[] data)

  construct the sharedformula record, save all the information

Parameters:
  `id` - id of the record -not validated, just stored for serialization
  `size` - size of the data
  `data` - the data

Method Detail

### serialize

    public int serialize(int offset,
                         byte[] data)

  spit the record out AS IS. no interperatation or identification

  Specified by:
    `serialize` in class `Record`
  Parameters:
    `offset` - to begin writing at
    `data` - byte array containing instance data
  Returns:
    number of bytes written

### getRecordSize

    public int getRecordSize()

  Description copied from class: `Record`
  gives the current serialized size of the record. Should include the sid and reclength (4 bytes).

  Overrides:
    `getRecordSize` in class `Record`

### validateSid

    protected void validateSid(short id)

  Description copied from class: `Record`
  called by constructor, should throw runtime exception in the event of a record passed with a differing ID.

  Specified by:
    `validateSid` in class `Record`
  Parameters:
    `id` - alleged id for this record

### toString

    public java.lang.String toString()

  print a sort of string representation ([SHARED FORMULA RECORD] id = x [/SHARED FORMULA RECORD])

  Overrides:
    `toString` in class `Record`

### getSid

    public short getSid()

  Description copied from class: `Record`
  return the non static version of the id for this record.

  Specified by:
    `getSid` in class `Record`

### fillFields

    protected void fillFields(byte[] data,
                              short size,
                              int offset)

  Shared formulas are to treated like unknown records, and as a result d

  Specified by:
    `fillFields` in class `Record`
  Parameters:
    `data` - raw data
    `size` - size of data
    `offset` - of the record's data (provided a big array of the file)

### isInValueSection

    public boolean isInValueSection()

  Mirroring formula records so it is registered in the ValueRecordsAggregate

  Overrides:
    `isInValueSection` in class `Record`

### isValue

    public boolean isValue()

  Register it in the ValueRecordsAggregate so it can go into the FormulaRecordAggregate

  Overrides:
    `isValue` in class `Record`

### clone

    public java.lang.Object clone()

  Overrides:
    `clone` in class `Record`

Copyright © 2003 Apache Software Foundation.