Exemplo n.º 1
0
        /**
         * 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();
            }
        }
Exemplo n.º 2
0
        /**
         * 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 = Frame.Utils.NPOI.SS.Formula.Formula.Read(field_7_expression_len, in1, in1.Available());
        }
Exemplo n.º 3
0
        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 = Frame.Utils.NPOI.SS.Formula.Formula.Read(formulaLen, in1, nBytesRemaining);
        }