示例#1
0
        /**
         * construct a unicode string record and fill its fields, ID is ignored
         * @param in the RecordInputstream to read the record from
         */
        public UnicodeString(RecordInputStream in1)
        {
            field_1_charCount   = in1.ReadShort();
            field_2_optionflags = (byte)in1.ReadByte();

            int RunCount        = 0;
            int extensionLength = 0;

            //Read the number of rich Runs if rich text.
            if (IsRichText)
            {
                RunCount = in1.ReadShort();
            }
            //Read the size of extended data if present.
            if (IsExtendedText)
            {
                extensionLength = in1.ReadInt();
            }

            bool IsCompressed = ((field_2_optionflags & 1) == 0);

            if (IsCompressed)
            {
                field_3_string = in1.ReadCompressedUnicode(CharCount);
            }
            else
            {
                field_3_string = in1.ReadUnicodeLEString(CharCount);
            }


            if (IsRichText && (RunCount > 0))
            {
                field_4_format_Runs = new List <FormatRun>(RunCount);
                for (int i = 0; i < RunCount; i++)
                {
                    field_4_format_Runs.Add(new FormatRun(in1));
                }
            }

            if (IsExtendedText && (extensionLength > 0))
            {
                field_5_ext_rst = new ExtRst(new ContinuableRecordInput(in1), extensionLength);
                if (field_5_ext_rst.DataSize + 4 != extensionLength)
                {
                    _logger.Log(POILogger.WARN, "ExtRst was supposed to be " + extensionLength + " bytes long, but seems to actually be " + (field_5_ext_rst.DataSize + 4));
                }
            }
        }