Top Description Fields Constructors Methods
org.apache.poi.hssf.record

public final Class FormulaRecord

extends CellRecord
Class Inheritance
Imports
java.util.Map, java.util.function.Supplier, org.apache.poi.ss.formula.Formula, org.apache.poi.ss.formula.ptg.Ptg, org.apache.poi.ss.usermodel.CellType, org.apache.poi.util.BitField, .BitFieldFactory, .GenericRecordUtil, .LittleEndianOutput, .Removal

Formula Record (0x0006).

Field Summary

Modifier and TypeField and Description
private static final BitField
private static final BitField
private double
private short
private int
field_6_zero

Unused field.

private Formula
private static final int
private static final BitField
public static final short
private FormulaSpecialCachedValue
specialCachedValue

Since the NaN support seems sketchy (different constants) we'll store and spit it out directly

Constructor Summary

AccessConstructor and Description
public
FormulaRecord()

Creates new FormulaRecord

public
public

Method Summary

Modifier and TypeMethod and Description
public FormulaRecord
public boolean
public int
public int

Returns:

The type of the cached value or CellType.NUMERIC.getCode() if the cached value is empty
getCachedResultType
()
Deprecated POI 5.0.0, will be removed in 6.0, use getCachedResultTypeEnum until switch to enum is fully done

public CellType

Returns:

The type of the cached value or CellType.NUMERIC if the cached value is empty
getCachedResultTypeEnum
()

Returns the type of the cached result

public Formula
public Map<String, Supplier<?>>
public HSSFRecordTypes
public short

Returns:

bitmask
getOptions
()

get the option flags

public Ptg[]

Returns:

the formula tokens. never null
getParsedExpression
()

protected String
getRecordName()

Implements abstract org.apache.poi.hssf.record.CellRecord.getRecordName.

Gets the debug info BIFF record type name (used by toString().

public short
getSid()

Implements abstract org.apache.poi.hssf.record.Record.getSid.

return the non static version of the id for this record.

public double

Returns:

calculated value
getValue
()

get the calculated value of the formula

protected int
public boolean

Returns:

true if this FormulaRecord is followed by a StringRecord representing the cached text result of the formula evaluation.
hasCachedResultString
()

public boolean
public boolean
public boolean
protected void
serializeValue(LittleEndianOutput
the output
out
)

Implements abstract org.apache.poi.hssf.record.CellRecord.serializeValue.

writes out the value data for this cell record

public void
setAlwaysCalc(boolean flag)

public void
setCachedResultBoolean(boolean value)

public void
setCachedResultErrorCode(int errorCode)

public void
public void
public void
setCalcOnLoad(boolean flag)

public void
setOptions(short
bitmask
options
)

set the option flags

public void
public void
setSharedFormula(boolean flag)

public void
setValue(double
calculated value
value
)

set the calculated value of the formula

Inherited from org.apache.poi.hssf.record.CellRecord:
getColumngetDataSizegetRowgetXFIndexserializesetColumnsetRowsetXFIndex

Field Detail

alwaysCalcback to summary
private static final BitField alwaysCalc
calcOnLoadback to summary
private static final BitField calcOnLoad
field_4_valueback to summary
private double field_4_value
field_5_optionsback to summary
private short field_5_options
field_6_zeroback to summary
private int field_6_zero

Unused field. As it turns out this field is often not zero.. According to Microsoft Excel Developer's Kit Page 318: when writing the chn field (offset 20), it's supposed to be 0 but ignored on read

field_8_parsed_exprback to summary
private Formula field_8_parsed_expr
FIXED_SIZEback to summary
private static final int FIXED_SIZE
sharedFormulaback to summary
private static final BitField sharedFormula
sidback to summary
public static final short sid
specialCachedValueback to summary
private FormulaSpecialCachedValue specialCachedValue

Since the NaN support seems sketchy (different constants) we'll store and spit it out directly

Constructor Detail

FormulaRecordback to summary
public FormulaRecord()

Creates new FormulaRecord

FormulaRecordback to summary
public FormulaRecord(FormulaRecord other)
FormulaRecordback to summary
public FormulaRecord(RecordInputStream ris)

Method Detail

copyback to summary
public FormulaRecord copy()

Implements abstract org.apache.poi.hssf.record.CellRecord.copy.

Implements org.apache.poi.common.Duplicatable.copy.

Returns:FormulaRecord

Doc from org.apache.poi.common.Duplicatable.copy.

a deep copy of the implementing class / instance

Annotations
@Override
getCachedBooleanValueback to summary
public boolean getCachedBooleanValue()
getCachedErrorValueback to summary
public int getCachedErrorValue()
getCachedResultTypeback to summary
public int getCachedResultType()

Deprecated

POI 5.0.0, will be removed in 6.0, use getCachedResultTypeEnum until switch to enum is fully done

Returns:int

The type of the cached value or CellType.NUMERIC.getCode() if the cached value is empty

Annotations
@Deprecated
@Removal
version:6.0.0
getCachedResultTypeEnumback to summary
public CellType getCachedResultTypeEnum()

Returns the type of the cached result

Returns:CellType

The type of the cached value or CellType.NUMERIC if the cached value is empty

Since
POI 5.0.0
getFormulaback to summary
public Formula getFormula()
getGenericPropertiesback to summary
public Map<String, Supplier<?>> getGenericProperties()

Overrides org.apache.poi.hssf.record.CellRecord.getGenericProperties.

Implements org.apache.poi.common.usermodel.GenericRecord.getGenericProperties.

Annotations
@Override
getGenericRecordTypeback to summary
public HSSFRecordTypes getGenericRecordType()

Overrides default org.apache.poi.common.usermodel.GenericRecord.getGenericRecordType.

Implements abstract org.apache.poi.hssf.record.Record.getGenericRecordType.

Annotations
@Override
getOptionsback to summary
public short getOptions()

get the option flags

Returns:short

bitmask

getParsedExpressionback to summary
public Ptg[] getParsedExpression()
Returns:Ptg[]

the formula tokens. never null

getRecordNameback to summary
protected String getRecordName()

Implements abstract org.apache.poi.hssf.record.CellRecord.getRecordName.

Doc from org.apache.poi.hssf.record.CellRecord.getRecordName.

Gets the debug info BIFF record type name (used by toString().

Returns:String

the record type name

Annotations
@Override
getSidback to summary
public short getSid()

Implements abstract org.apache.poi.hssf.record.Record.getSid.

Doc from org.apache.poi.hssf.record.Record.getSid.

return the non static version of the id for this record.

Returns:short

he id for this record

Annotations
@Override
getValueback to summary
public double getValue()

get the calculated value of the formula

Returns:double

calculated value

getValueDataSizeback to summary
protected int getValueDataSize()

Implements abstract org.apache.poi.hssf.record.CellRecord.getValueDataSize.

Returns:int

Doc from org.apache.poi.hssf.record.CellRecord.getValueDataSize.

the size (in bytes) of the value data for this cell record

Annotations
@Override
hasCachedResultStringback to summary
public boolean hasCachedResultString()
Returns:boolean

true if this FormulaRecord is followed by a StringRecord representing the cached text result of the formula evaluation.

isAlwaysCalcback to summary
public boolean isAlwaysCalc()
isCalcOnLoadback to summary
public boolean isCalcOnLoad()
isSharedFormulaback to summary
public boolean isSharedFormula()
serializeValueback to summary
protected void serializeValue(LittleEndianOutput out)

Implements abstract org.apache.poi.hssf.record.CellRecord.serializeValue.

Doc from org.apache.poi.hssf.record.CellRecord.serializeValue.

writes out the value data for this cell record

Parameters
out:LittleEndianOutput

the output

Annotations
@Override
setAlwaysCalcback to summary
public void setAlwaysCalc(boolean flag)
setCachedResultBooleanback to summary
public void setCachedResultBoolean(boolean value)
setCachedResultErrorCodeback to summary
public void setCachedResultErrorCode(int errorCode)
setCachedResultTypeEmptyStringback to summary
public void setCachedResultTypeEmptyString()
setCachedResultTypeStringback to summary
public void setCachedResultTypeString()
setCalcOnLoadback to summary
public void setCalcOnLoad(boolean flag)
setOptionsback to summary
public void setOptions(short options)

set the option flags

Parameters
options:short

bitmask

setParsedExpressionback to summary
public void setParsedExpression(Ptg[] ptgs)
setSharedFormulaback to summary
public void setSharedFormula(boolean flag)
setValueback to summary
public void setValue(double value)

set the calculated value of the formula

Parameters
value:double

calculated value