コード例 #1
0
ファイル: FontRecord.cs プロジェクト: wondaz/hello-world
        /**
         * Constructs a Font record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public FontRecord(RecordInputStream in1)
        {
            field_1_font_height         = in1.ReadShort();
            field_2_attributes          = in1.ReadShort();
            field_3_color_palette_index = in1.ReadShort();
            field_4_bold_weight         = in1.ReadShort();
            field_5_base_sub_script     = in1.ReadShort();
            field_6_underline           = (byte)in1.ReadByte();
            field_7_family  = (byte)in1.ReadByte();
            field_8_charset = (byte)in1.ReadByte();
            field_9_zero    = (byte)in1.ReadByte();
            int field_10_font_name_len = (byte)in1.ReadByte();
            int unicodeFlags           = in1.ReadUByte(); // options byte present always (even if no character data)

            if (field_10_font_name_len > 0)
            {
                if (unicodeFlags == 0)
                {   // Is compressed Unicode
                    field_11_font_name = in1.ReadCompressedUnicode(field_10_font_name_len);
                }
                else
                {   // Is not compressed Unicode
                    field_11_font_name = in1.ReadUnicodeLEString(field_10_font_name_len);
                }
            }
            else
            {
                field_11_font_name = "";
            }
        }
コード例 #2
0
        private static String ReadRawString(RecordInputStream in1, int textLength)
        {
            byte compressByte = (byte)in1.ReadByte();
            bool isCompressed = (compressByte & 0x01) == 0;

            if (isCompressed)
            {
                return(in1.ReadCompressedUnicode(textLength));
            }
            return(in1.ReadUnicodeLEString(textLength));
        }
コード例 #3
0
ファイル: UnicodeString.cs プロジェクト: wondaz/hello-world
        /**
         * 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));
                }
            }
        }
コード例 #4
0
ファイル: StringRecord.cs プロジェクト: wondaz/hello-world
        /**
         * Constructs a String record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */
        public StringRecord(RecordInputStream in1)
        {
            int field_1_string_length = in1.ReadShort();

            _is16bitUnicode = in1.ReadByte() != 0x00;

            if (_is16bitUnicode)
            {
                _text = in1.ReadUnicodeLEString(field_1_string_length);
            }
            else
            {
                _text = in1.ReadCompressedUnicode(field_1_string_length);
            }
        }
コード例 #5
0
ファイル: FormatRecord.cs プロジェクト: wondaz/hello-world
        /**
         * Constructs a Format record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public FormatRecord(RecordInputStream in1)
        {
            field_1_index_code = in1.ReadShort();
            int field_3_unicode_len = in1.ReadShort();

            field_3_hasMultibyte = (in1.ReadByte() & (byte)0x01) != 0;

            if (field_3_hasMultibyte)
            {
                // Unicode
                field_4_formatstring = in1.ReadUnicodeLEString(field_3_unicode_len);
            }
            else
            {
                // not Unicode
                field_4_formatstring = in1.ReadCompressedUnicode(field_3_unicode_len);
            }
        }
コード例 #6
0
        /**
         * Constructs a BoundSheetRecord and Sets its fields appropriately
         *
         * @param in the RecordInputstream to Read the record from
         */

        public BoundSheetRecord(RecordInputStream in1)
        {
            field_1_position_of_BOF = in1.ReadInt();           // bof
            field_2_option_flags    = in1.ReadShort();         // flags
            int field_3_sheetname_length = in1.ReadUByte();    // len(str)

            field_4_isMultibyteUnicode = (byte)in1.ReadByte(); // Unicode


            if (this.IsMultibyte)
            {
                field_5_sheetname = in1.ReadUnicodeLEString(field_3_sheetname_length);
            }
            else
            {
                field_5_sheetname = in1.ReadCompressedUnicode(field_3_sheetname_length);
            }
        }
コード例 #7
0
        /**
         * Constructs a FileSharing record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public FileSharingRecord(RecordInputStream in1)
        {
            field_1_Readonly = in1.ReadShort();
            field_2_password = in1.ReadShort();

            int nameLen = in1.ReadShort();

            if (nameLen > 0)
            {
                // TODO - Current examples(3) from junits only have zero Length username.
                field_3_username_unicode_options = (byte)in1.ReadByte();
                field_3_username_value           = in1.ReadCompressedUnicode(nameLen);
            }
            else
            {
                field_3_username_value = "";
            }
        }
コード例 #8
0
        protected HeaderFooterBase(RecordInputStream in1)
        {
            if (in1.Remaining > 0)
            {
                int field_1_footer_len = in1.ReadShort();
                field_2_hasMultibyte = in1.ReadByte() != 0x00;

                if (field_2_hasMultibyte)
                {
                    field_3_text = in1.ReadUnicodeLEString(field_1_footer_len);
                }
                else
                {
                    field_3_text = in1.ReadCompressedUnicode(field_1_footer_len);
                }
            }
            else
            {
                // Note - this is unusual for BIFF records in general, but normal for header / footer records:
                // when the text is empty string, the whole record is empty (just the 4 byte BIFF header)
                field_3_text = "";
            }
        }
コード例 #9
0
ファイル: LabelRecord.cs プロジェクト: wondaz/hello-world
        /**
         * Constructs an Label record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public LabelRecord(RecordInputStream in1)
        {
            field_1_row          = in1.ReadUShort();
            field_2_column       = in1.ReadUShort();
            field_3_xf_index     = in1.ReadShort();
            field_4_string_len   = in1.ReadShort();
            field_5_unicode_flag = (byte)in1.ReadByte();
            if (field_4_string_len > 0)
            {
                if (IsUncompressedUnicode)
                {
                    field_6_value = in1.ReadUnicodeLEString(field_4_string_len);
                }
                else
                {
                    field_6_value = in1.ReadCompressedUnicode(field_4_string_len);
                }
            }
            else
            {
                field_6_value = "";
            }
        }