public OldFormulaRecord(RecordInputStream ris) : base(ris, ris.Sid == biff2_sid) { ; if (IsBiff2) { field_4_value = ris.ReadDouble(); } else { long valueLongBits = ris.ReadLong(); specialCachedValue = SpecialCachedValue.Create(valueLongBits); if (specialCachedValue == null) { field_4_value = BitConverter.Int64BitsToDouble(valueLongBits); } } if (IsBiff2) { field_5_options = (short)ris.ReadUByte(); } else { field_5_options = ris.ReadShort(); } int expression_len = ris.ReadShort(); int nBytesAvailable = ris.Available(); field_6_Parsed_expr = Formula.Read(expression_len, ris, nBytesAvailable); }
/** * @param in the RecordInputstream to Read the record from */ public SharedFormulaRecord(RecordInputStream in1) : base(in1) { field_5_reserved = in1.ReadShort(); int field_6_expression_len = in1.ReadShort(); int nAvailableBytes = in1.Available(); field_7_parsed_expr = NPOI.SS.Formula.Formula.Read(field_6_expression_len, in1, nAvailableBytes); }
public ArrayRecord(RecordInputStream in1) : base(in1) { _options = in1.ReadUShort(); _field3notUsed = in1.ReadInt(); int formulaTokenLen = in1.ReadUShort(); int totalFormulaLen = in1.Available(); _formula = NPOI.SS.Formula.Formula.Read(formulaTokenLen, in1, totalFormulaLen); }
/** * Constructs a EOFRecord record and Sets its fields appropriately. * @param in the RecordInputstream to Read the record from */ public ExtSSTRecord(RecordInputStream in1) { field_1_strings_per_bucket = in1.ReadShort(); int nInfos = in1.Remaining / InfoSubRecord.ENCODED_SIZE; List<InfoSubRecord> lst = new List<InfoSubRecord>(nInfos); while (in1.Available() > 0) { InfoSubRecord info = new InfoSubRecord(in1); lst.Add(info); if (in1.Available() == 0 && in1.HasNextRecord && in1.GetNextSid() == ContinueRecord.sid) { in1.NextRecord(); } } _sstInfos = lst.ToArray(); }
public ChartEndBlockRecord(RecordInputStream in1) { rt = in1.ReadShort(); grbitFrt = in1.ReadShort(); iObjectKind = in1.ReadShort(); // Often, but not always has 6 unused bytes at the end if(in1.Available() == 0) { unused = new byte[0]; } else { unused = new byte[6]; in1.ReadFully(unused); } }
public CatLabRecord(RecordInputStream in1) { rt = in1.ReadShort(); grbitFrt = in1.ReadShort(); wOffset = in1.ReadShort(); at = in1.ReadShort(); grbit = in1.ReadShort(); // Often, but not always has an unused short at the end if (in1.Available() == 0) { unused = null; } else { unused = in1.ReadShort(); } }
/** * This Is the starting point where strings are constructed. Note that * strings may span across multiple continuations. Read the SST record * carefully before beginning to hack. */ public void ManufactureStrings(int stringCount, RecordInputStream in1) { for (int i = 0; i < stringCount; i++) { // Extract exactly the count of strings from the SST record. UnicodeString str; if (in1.Available() == 0 && !in1.HasNextRecord) { System.Console.WriteLine("Ran out of data before creating all the strings! String at index " + i + ""); str = new UnicodeString(""); } else { str = new UnicodeString(in1); } AddToStringTable(strings, str); } }
public ChartEndObjectRecord(RecordInputStream in1) { rt = in1.ReadShort(); grbitFrt = in1.ReadShort(); iObjectKind = in1.ReadShort(); // The spec says that there should be 6 bytes at the // end, which must be there and must be zero // However, sometimes Excel forgets them... reserved = new byte[6]; if (in1.Available() == 0) { // They've gone missing... } else { // Read the reserved bytes in1.ReadFully(reserved); } }
/** * Constructs a <c>NoteRecord</c> and Fills its fields * from the supplied <c>RecordInputStream</c>. * * @param in the stream to Read from */ public NoteRecord(RecordInputStream in1) { field_1_row = in1.ReadShort(); field_2_col = in1.ReadUShort(); field_3_flags = in1.ReadShort(); field_4_shapeid = in1.ReadUShort(); int length = in1.ReadShort(); field_5_hasMultibyte = in1.ReadByte() != 0x00; if (field_5_hasMultibyte) { field_6_author = StringUtil.ReadUnicodeLE(in1, length); } else { field_6_author = StringUtil.ReadCompressedUnicode(in1, length); } if (in1.Available() == 1) { field_7_padding = (byte)in1.ReadByte(); } }
public ExternalNameRecord(RecordInputStream in1) { field_1_option_flag = in1.ReadShort(); field_2_ixals = in1.ReadShort(); field_3_not_used = in1.ReadShort(); int numChars = in1.ReadUByte(); field_4_name = StringUtil.ReadUnicodeString(in1, numChars); // the record body can take different forms. // The form is dictated by the values of 3-th and 4-th bits in field_1_option_flag if (!IsOLELink && !IsStdDocumentNameIdentifier) { // another switch: the fWantAdvise bit specifies whether the body describes // an external defined name or a DDE data item if (IsAutomaticLink) { if (in1.Available() > 0) { //body specifies DDE data item int nColumns = in1.ReadUByte() + 1; int nRows = in1.ReadShort() + 1; int totalCount = nRows * nColumns; _ddeValues = ConstantValueParser.Parse(in1, totalCount); _nColumns = nColumns; _nRows = nRows; } } else { //body specifies an external defined name int formulaLen = in1.ReadUShort(); field_5_name_definition = Formula.Read(formulaLen, in1); } } }
public ExternalNameRecord(RecordInputStream in1) { field_1_option_flag = in1.ReadShort(); field_2_ixals = in1.ReadShort(); field_3_not_used = in1.ReadShort(); int numChars = in1.ReadUByte(); field_4_name = StringUtil.ReadUnicodeString(in1, numChars); // the record body can take different forms. // The form is dictated by the values of 3-th and 4-th bits in field_1_option_flag if (!IsOLELink && !IsStdDocumentNameIdentifier) { // another switch: the fWantAdvise bit specifies whether the body describes // an external defined name or a DDE data item if (IsAutomaticLink) { if (in1.Available() > 0) { //body specifies DDE data item int nColumns = in1.ReadUByte() + 1; int nRows = in1.ReadShort() + 1; int totalCount = nRows * nColumns; _ddeValues = ConstantValueParser.Parse(in1, totalCount); _nColumns = nColumns; _nRows = nRows; } } else { //body specifies an external defined name int formulaLen = in1.ReadUShort(); field_5_name_definition = Formula.Read(formulaLen, in1); } } }
/** * Constructs a Formula record and Sets its fields appropriately. * Note - id must be 0x06 (NOT 0x406 see MSKB #Q184647 for an * "explanation of this bug in the documentation) or an exception * will be throw upon validation * * @param in the RecordInputstream to Read the record from */ public FormulaRecord(RecordInputStream in1):base(in1) { long valueLongBits = in1.ReadLong(); field_5_options = in1.ReadShort(); specialCachedValue = SpecialCachedValue.Create(valueLongBits); if (specialCachedValue == null) { field_4_value = BitConverter.Int64BitsToDouble(valueLongBits); } field_6_zero = in1.ReadInt(); int field_7_expression_len = in1.ReadShort(); field_8_parsed_expr = NPOI.SS.Formula.Formula.Read(field_7_expression_len, in1,in1.Available()); }
public ExternalNameRecord(RecordInputStream in1) { field_1_option_flag = in1.ReadShort(); field_2_ixals = in1.ReadShort(); field_3_not_used = in1.ReadShort(); int numChars = in1.ReadUByte(); field_4_name = StringUtil.ReadUnicodeString(in1, numChars); // the record body can take different forms. // The form is dictated by the values of 3-th and 4-th bits in field_1_option_flag if (!IsOLELink && !IsStdDocumentNameIdentifier) { // another switch: the fWantAdvise bit specifies whether the body describes // an external defined name or a DDE data item if (IsAutomaticLink) { if (in1.Available() > 0) { //body specifies DDE data item int nColumns = in1.ReadUByte() + 1; int nRows = in1.ReadShort() + 1; int totalCount = nRows * nColumns; _ddeValues = ConstantValueParser.Parse(in1, totalCount); _nColumns = nColumns; _nRows = nRows; } } else { //body specifies an external defined name int formulaLen = in1.ReadUShort(); field_5_name_definition = Formula.Read(formulaLen, in1); } } //int nameLength = in1.ReadUByte(); //int multibyteFlag = in1.ReadUByte(); //if (multibyteFlag == 0) //{ // field_4_name = in1.ReadCompressedUnicode(nameLength); //} //else //{ // field_4_name = in1.ReadUnicodeLEString(nameLength); //} //if (!HasFormula) //{ // if (!IsStdDocumentNameIdentifier && !IsOLELink && IsAutomaticLink) // { // // both need to be incremented // int nColumns = in1.ReadUByte() + 1; // int nRows = in1.ReadShort() + 1; // int totalCount = nRows * nColumns; // _ddeValues = ConstantValueParser.Parse(in1, totalCount); // _nColumns = nColumns; // _nRows = nRows; // } // if (in1.Remaining > 0) // { // throw ReadFail("Some Unread data (is formula present?)"); // } // field_5_name_definition = null; // return; //} //int nBytesRemaining = in1.Available(); //if (in1.Remaining <= 0) //{ // throw ReadFail("Ran out of record data trying to read formula."); //} //short formulaLen = in1.ReadShort(); //nBytesRemaining -= 2; //field_5_name_definition = NPOI.SS.Formula.Formula.Read(formulaLen, in1, nBytesRemaining); }
/** * Constructs a Formula record and Sets its fields appropriately. * Note - id must be 0x06 (NOT 0x406 see MSKB #Q184647 for an * "explanation of this bug in the documentation) or an exception * will be throw upon validation * * @param in the RecordInputstream to Read the record from */ public FormulaRecord(RecordInputStream in1) : base(in1) { long valueLongBits = in1.ReadLong(); field_5_options = in1.ReadShort(); specialCachedValue = SpecialCachedValue.Create(valueLongBits); if (specialCachedValue == null) { field_4_value = BitConverter.Int64BitsToDouble(valueLongBits); } field_6_zero = in1.ReadInt(); int field_7_expression_len = in1.ReadShort(); field_8_parsed_expr = NPOI.SS.Formula.Formula.Read(field_7_expression_len, in1, in1.Available()); }
/** * Constructs a <c>NoteRecord</c> and Fills its fields * from the supplied <c>RecordInputStream</c>. * * @param in the stream to Read from */ public NoteRecord(RecordInputStream in1) { field_1_row = in1.ReadShort(); field_2_col = in1.ReadUShort(); field_3_flags = in1.ReadShort(); field_4_shapeid = in1.ReadUShort(); int length = in1.ReadShort(); field_5_hasMultibyte = in1.ReadByte() != 0x00; if (field_5_hasMultibyte) { field_6_author = StringUtil.ReadUnicodeLE(in1, length); } else { field_6_author = StringUtil.ReadCompressedUnicode(in1, length); } if (in1.Available() == 1) { field_7_padding = (byte)in1.ReadByte(); } }
public ExternalNameRecord(RecordInputStream in1) { field_1_option_flag = in1.ReadShort(); field_2_index = in1.ReadShort(); field_3_not_used = in1.ReadShort(); int nameLength = in1.ReadUByte(); int multibyteFlag = in1.ReadUByte(); if (multibyteFlag == 0) { field_4_name = in1.ReadCompressedUnicode(nameLength); } else { field_4_name = in1.ReadUnicodeLEString(nameLength); } if (!HasFormula) { if (!IsStdDocumentNameIdentifier && !IsOLELink && IsAutomaticLink) { // both need to be incremented int nColumns = in1.ReadUByte() + 1; int nRows = in1.ReadShort() + 1; int totalCount = nRows * nColumns; _ddeValues = ConstantValueParser.Parse(in1, totalCount); _nColumns = nColumns; _nRows = nRows; } if (in1.Remaining > 0) { throw ReadFail("Some Unread data (is formula present?)"); } field_5_name_definition = null; return; } int nBytesRemaining = in1.Available(); if (in1.Remaining <= 0) { throw ReadFail("Ran out of record data trying to read formula."); } short formulaLen = in1.ReadShort(); nBytesRemaining -= 2; field_5_name_definition = NPOI.SS.Formula.Formula.Read(formulaLen, in1, nBytesRemaining); }
/** * Constructs a Name record and Sets its fields appropriately. * * @param in the RecordInputstream to Read the record from */ public NameRecord(RecordInputStream in1) { field_1_option_flag = in1.ReadShort(); field_2_keyboard_shortcut = (byte)in1.ReadByte(); int field_3_length_name_text = in1.ReadByte(); int field_4_length_name_definition = in1.ReadShort(); field_5_externSheetIndex_plus1 = in1.ReadShort(); field_6_sheetNumber = in1.ReadUShort(); int field_7_length_custom_menu = in1.ReadUByte(); int field_8_length_description_text = in1.ReadUByte(); int field_9_length_help_topic_text = in1.ReadUByte(); int field_10_length_status_bar_text = in1.ReadUByte(); //store the name in byte form if it's a built-in name field_11_nameIsMultibyte = (in1.ReadByte() != 0); if (IsBuiltInName) { field_12_built_in_code = (byte)in1.ReadByte(); } else { if (field_11_nameIsMultibyte) { field_12_name_text = in1.ReadUnicodeLEString(field_3_length_name_text); } else { field_12_name_text = in1.ReadCompressedUnicode(field_3_length_name_text); } } int nBytesAvailable = in1.Available() - (field_7_length_custom_menu + field_8_length_description_text + field_9_length_help_topic_text + field_10_length_status_bar_text); field_13_name_definition = SSFormula.Formula.Read(field_4_length_name_definition, in1, nBytesAvailable); //Who says that this can only ever be compressed unicode??? field_14_custom_menu_text = in1.ReadCompressedUnicode(field_7_length_custom_menu); field_15_description_text = in1.ReadCompressedUnicode(field_8_length_description_text); field_16_help_topic_text = in1.ReadCompressedUnicode(field_9_length_help_topic_text); field_17_status_bar_text = in1.ReadCompressedUnicode(field_10_length_status_bar_text); }
public ExternalNameRecord(RecordInputStream in1) { field_1_option_flag = in1.ReadShort(); field_2_ixals = in1.ReadShort(); field_3_not_used = in1.ReadShort(); int numChars = in1.ReadUByte(); field_4_name = StringUtil.ReadUnicodeString(in1, numChars); // the record body can take different forms. // The form is dictated by the values of 3-th and 4-th bits in field_1_option_flag if (!IsOLELink && !IsStdDocumentNameIdentifier) { // another switch: the fWantAdvise bit specifies whether the body describes // an external defined name or a DDE data item if (IsAutomaticLink) { if (in1.Available() > 0) { //body specifies DDE data item int nColumns = in1.ReadUByte() + 1; int nRows = in1.ReadShort() + 1; int totalCount = nRows * nColumns; _ddeValues = ConstantValueParser.Parse(in1, totalCount); _nColumns = nColumns; _nRows = nRows; } } else { //body specifies an external defined name int formulaLen = in1.ReadUShort(); field_5_name_definition = Formula.Read(formulaLen, in1); } } //int nameLength = in1.ReadUByte(); //int multibyteFlag = in1.ReadUByte(); //if (multibyteFlag == 0) //{ // field_4_name = in1.ReadCompressedUnicode(nameLength); //} //else //{ // field_4_name = in1.ReadUnicodeLEString(nameLength); //} //if (!HasFormula) //{ // if (!IsStdDocumentNameIdentifier && !IsOLELink && IsAutomaticLink) // { // // both need to be incremented // int nColumns = in1.ReadUByte() + 1; // int nRows = in1.ReadShort() + 1; // int totalCount = nRows * nColumns; // _ddeValues = ConstantValueParser.Parse(in1, totalCount); // _nColumns = nColumns; // _nRows = nRows; // } // if (in1.Remaining > 0) // { // throw ReadFail("Some Unread data (is formula present?)"); // } // field_5_name_definition = null; // return; //} //int nBytesRemaining = in1.Available(); //if (in1.Remaining <= 0) //{ // throw ReadFail("Ran out of record data trying to read formula."); //} //short formulaLen = in1.ReadShort(); //nBytesRemaining -= 2; //field_5_name_definition = NPOI.SS.Formula.Formula.Read(formulaLen, in1, nBytesRemaining); }