extends Record
implements CellValueRecordInterface, Comparable
{
+
+ public static final boolean EXPERIMENTAL_FORMULA_SUPPORT_ENABLED=false;
+
public static final short sid =
0x06; // docs say 406...because of a bug Microsoft support site article #Q184647)
+
private short field_1_row;
private short field_2_column;
private short field_3_xf;
private int field_6_zero;
private short field_7_expression_len;
private Stack field_8_parsed_expr;
+
+ private byte[] all_data; //if formula support is not enabled then
+ //we'll just store/reserialize
/** Creates new FormulaRecord */
protected void fillFields(byte [] data, short size, int offset)
{
+ if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
field_1_row = LittleEndian.getShort(data, 0 + offset);
field_2_column = LittleEndian.getShort(data, 2 + offset);
field_3_xf = LittleEndian.getShort(data, 4 + offset);
field_5_options = LittleEndian.getShort(data, 14 + offset);
field_6_zero = LittleEndian.getInt(data, 16 + offset);
field_7_expression_len = LittleEndian.getShort(data, 20 + offset);
+ field_8_parsed_expr = getParsedExpressionTokens(data, size,
+ offset);
+
+ } else {
+ all_data = new byte[size+4];
+ LittleEndian.putShort(all_data,0,sid);
+ LittleEndian.putShort(all_data,2,size);
+ System.arraycopy(data,offset,all_data,4,size);
+ }
- // field_8_parsed_expr = getParsedExpressionTokens(data, size,
- // offset);
}
private Stack getParsedExpressionTokens(byte [] data, short size,
public int serialize(int offset, byte [] data)
{
+ if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
int ptgSize = getTotalPtgSize();
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 18 + offset, getOptions());
LittleEndian.putInt(data, 20 + offset, field_6_zero);
LittleEndian.putShort(data, 24 + offset, getExpressionLength());
+ } else {
+ System.arraycopy(all_data,0,data,offset,all_data.length);
+ }
// serializePtgs(data, 26+offset);
return getRecordSize();
public int getRecordSize()
{
- return 0;
+ int retval =0;
+
+ if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
+ retval = getTotalPtgSize() + 28;
+ } else {
+ retval =all_data.length;
+ }
+ return retval;
// return getTotalPtgSize() + 28;
}
public class RecordFactory
{
private static int NUM_RECORDS = 10000;
- private static final Class[] records = new Class[]
- {
- BOFRecord.class, InterfaceHdrRecord.class, MMSRecord.class,
- InterfaceEndRecord.class, WriteAccessRecord.class,
- CodepageRecord.class, DSFRecord.class, TabIdRecord.class,
- FnGroupCountRecord.class, WindowProtectRecord.class,
- ProtectRecord.class, PasswordRecord.class, ProtectionRev4Record.class,
- PasswordRev4Record.class, WindowOneRecord.class, BackupRecord.class,
- HideObjRecord.class, DateWindow1904Record.class,
- PrecisionRecord.class, RefreshAllRecord.class, BookBoolRecord.class,
- FontRecord.class, FormatRecord.class, ExtendedFormatRecord.class,
- StyleRecord.class, UseSelFSRecord.class, BoundSheetRecord.class,
- CountryRecord.class, SSTRecord.class, ExtSSTRecord.class,
- EOFRecord.class, IndexRecord.class, CalcModeRecord.class,
- CalcCountRecord.class, RefModeRecord.class, IterationRecord.class,
- DeltaRecord.class, SaveRecalcRecord.class, PrintHeadersRecord.class,
- PrintGridlinesRecord.class, GridsetRecord.class, GutsRecord.class,
- DefaultRowHeightRecord.class, WSBoolRecord.class, HeaderRecord.class,
- FooterRecord.class, HCenterRecord.class, VCenterRecord.class,
- PrintSetupRecord.class, DefaultColWidthRecord.class,
- DimensionsRecord.class, RowRecord.class, LabelSSTRecord.class,
- RKRecord.class, NumberRecord.class, DBCellRecord.class,
- WindowTwoRecord.class, SelectionRecord.class, ContinueRecord.class,
- LabelRecord.class, BlankRecord.class, ColumnInfoRecord.class,
- MulRKRecord.class, MulBlankRecord.class, MergeCellsRecord.class,
- FormulaRecord.class, BoolErrRecord.class
- };
+ private static final Class[] records;
+
+ static {
+ if (FormulaRecord.EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
+ records = new Class[]
+ {
+ BOFRecord.class, InterfaceHdrRecord.class, MMSRecord.class,
+ InterfaceEndRecord.class, WriteAccessRecord.class,
+ CodepageRecord.class, DSFRecord.class, TabIdRecord.class,
+ FnGroupCountRecord.class, WindowProtectRecord.class,
+ ProtectRecord.class, PasswordRecord.class, ProtectionRev4Record.class,
+ PasswordRev4Record.class, WindowOneRecord.class, BackupRecord.class,
+ HideObjRecord.class, DateWindow1904Record.class,
+ PrecisionRecord.class, RefreshAllRecord.class, BookBoolRecord.class,
+ FontRecord.class, FormatRecord.class, ExtendedFormatRecord.class,
+ StyleRecord.class, UseSelFSRecord.class, BoundSheetRecord.class,
+ CountryRecord.class, SSTRecord.class, ExtSSTRecord.class,
+ EOFRecord.class, IndexRecord.class, CalcModeRecord.class,
+ CalcCountRecord.class, RefModeRecord.class, IterationRecord.class,
+ DeltaRecord.class, SaveRecalcRecord.class, PrintHeadersRecord.class,
+ PrintGridlinesRecord.class, GridsetRecord.class, GutsRecord.class,
+ DefaultRowHeightRecord.class, WSBoolRecord.class, HeaderRecord.class,
+ FooterRecord.class, HCenterRecord.class, VCenterRecord.class,
+ PrintSetupRecord.class, DefaultColWidthRecord.class,
+ DimensionsRecord.class, RowRecord.class, LabelSSTRecord.class,
+ RKRecord.class, NumberRecord.class, DBCellRecord.class,
+ WindowTwoRecord.class, SelectionRecord.class, ContinueRecord.class,
+ LabelRecord.class, BlankRecord.class, ColumnInfoRecord.class,
+ MulRKRecord.class, MulBlankRecord.class, MergeCellsRecord.class,
+ FormulaRecord.class, BoolErrRecord.class
+ };
+ } else {
+ records = new Class[]
+ {
+ BOFRecord.class, InterfaceHdrRecord.class, MMSRecord.class,
+ InterfaceEndRecord.class, WriteAccessRecord.class,
+ CodepageRecord.class, DSFRecord.class, TabIdRecord.class,
+ FnGroupCountRecord.class, WindowProtectRecord.class,
+ ProtectRecord.class, PasswordRecord.class, ProtectionRev4Record.class,
+ PasswordRev4Record.class, WindowOneRecord.class, BackupRecord.class,
+ HideObjRecord.class, DateWindow1904Record.class,
+ PrecisionRecord.class, RefreshAllRecord.class, BookBoolRecord.class,
+ FontRecord.class, FormatRecord.class, ExtendedFormatRecord.class,
+ StyleRecord.class, UseSelFSRecord.class, BoundSheetRecord.class,
+ CountryRecord.class, SSTRecord.class, ExtSSTRecord.class,
+ EOFRecord.class, IndexRecord.class, CalcModeRecord.class,
+ CalcCountRecord.class, RefModeRecord.class, IterationRecord.class,
+ DeltaRecord.class, SaveRecalcRecord.class, PrintHeadersRecord.class,
+ PrintGridlinesRecord.class, GridsetRecord.class, GutsRecord.class,
+ DefaultRowHeightRecord.class, WSBoolRecord.class, HeaderRecord.class,
+ FooterRecord.class, HCenterRecord.class, VCenterRecord.class,
+ PrintSetupRecord.class, DefaultColWidthRecord.class,
+ DimensionsRecord.class, RowRecord.class, LabelSSTRecord.class,
+ RKRecord.class, NumberRecord.class, DBCellRecord.class,
+ WindowTwoRecord.class, SelectionRecord.class, ContinueRecord.class,
+ LabelRecord.class, BlankRecord.class, ColumnInfoRecord.class,
+ MulRKRecord.class, MulBlankRecord.class, MergeCellsRecord.class,
+ BoolErrRecord.class
+ };
+
+ }
+ }
private static Map recordsMap = recordsToMap(records);
/**