public CRNRecord(RecordInputStream in1) { field_1_last_column_index = in1.ReadByte() & 0x00FF; field_2_first_column_index = in1.ReadByte() & 0x00FF; field_3_row_index = in1.ReadShort(); int nValues = field_1_last_column_index - field_2_first_column_index + 1; field_4_constant_values = ConstantValueParser.Parse(in1, nValues); }
public void TestDecode() { ILittleEndianInput in1 = TestcaseRecordInputStream.CreateLittleEndian(SAMPLE_ENCODING); object[] values = ConstantValueParser.Parse(in1, 4); for (int i = 0; i < values.Length; i++) { if (!IsEqual(SAMPLE_VALUES[i], values[i])) { Assert.Fail("Decoded result differs"); } } }
public void TestDecode() { RecordInputStream inStream = TestcaseRecordInputStream.CreateWithFakeSid(SAMPLE_ENCODING); object[] values = ConstantValueParser.Parse(inStream, 4); for (int i = 0; i < values.Length; i++) { if (!IsEqual(SAMPLE_VALUES[i], values[i])) { Assert.Fail("Decoded result differs"); } } }
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); }
/** * Read in the actual token (array) values. This occurs * AFTER the last Ptg in the expression. * See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf */ public void ReadTokenValues(LittleEndianInput in1) { short nColumns = (short)in1.ReadUByte(); short nRows = in1.ReadShort(); //The token_1_columns and token_2_rows do not follow the documentation. //The number of physical rows and columns is actually +1 of these values. //Which is not explicitly documented. nColumns++; nRows++; token_1_columns = nColumns; token_2_rows = nRows; int totalCount = nRows * nColumns; token_3_arrayValues = ConstantValueParser.Parse(in1, totalCount); }
/** * Read in the actual token (array) values. This occurs * AFTER the last Ptg in the expression. * See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf */ public ArrayPtg FinishReading(ILittleEndianInput in1) { int nColumns = in1.ReadUByte(); short nRows = in1.ReadShort(); //The token_1_columns and token_2_rows do not follow the documentation. //The number of physical rows and columns is actually +1 of these values. //Which is not explicitly documented. nColumns++; nRows++; int totalCount = nRows * nColumns; Object[] arrayValues = ConstantValueParser.Parse(in1, totalCount); ArrayPtg result = new ArrayPtg(_reserved0, _reserved1, _reserved2, nColumns, nRows, arrayValues); result.PtgClass = this.PtgClass; return(result); }
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); } } //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 = Zephyr.Utils.NPOI.SS.Formula.Formula.Read(formulaLen, in1, nBytesRemaining); }