コード例 #1
0
ファイル: DVRecord.cs プロジェクト: zanhaipeng/npoi
        /**
         * Constructs a DV record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public DVRecord(RecordInputStream in1)
        {
            _option_flags = in1.ReadInt();

            _promptTitle = ReadUnicodeString(in1);
            _errorTitle  = ReadUnicodeString(in1);
            _promptText  = ReadUnicodeString(in1);
            _errorText   = ReadUnicodeString(in1);

            int field_size_first_formula = in1.ReadUShort();

            _not_used_1 = in1.ReadShort();

            //read first formula data condition
            _formula1 = NPOI.SS.Formula.Formula.Read(field_size_first_formula, in1);

            int field_size_sec_formula = in1.ReadUShort();

            _not_used_2 = in1.ReadShort();

            //read sec formula data condition
            _formula2 = NPOI.SS.Formula.Formula.Read(field_size_sec_formula, in1);

            //read cell range address list with all affected ranges
            _regions = new CellRangeAddressList(in1);
        }
コード例 #2
0
ファイル: LabelRecord.cs プロジェクト: FilRip/IMDEV.Commun
        /**
         * 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 = "";
            }
            if (in1.Remaining > 0)
            {
                logger.Log(POILogger.INFO, "LabelRecord data remains: " + in1.Remaining +
                           " : " + HexDump.ToHex(in1.ReadRemainder()));
            }
        }
コード例 #3
0
            public void Read(RecordInputStream in1)
            {
                _encryptionInfo = in1.ReadUShort();
                switch (_encryptionInfo)
                {
                case ENCRYPTION_OTHER_RC4:
                    // handled below
                    break;

                case ENCRYPTION_OTHER_CAPI_2:
                case ENCRYPTION_OTHER_CAPI_3:
                case ENCRYPTION_OTHER_CAPI_4:
                    throw new EncryptedDocumentException(
                              "HSSF does not currently support CryptoAPI encryption");

                default:
                    throw new RecordFormatException("Unknown encryption info " + _encryptionInfo);
                }
                _minorVersionNo = in1.ReadUShort();
                if (_minorVersionNo != 1)
                {
                    throw new RecordFormatException("Unexpected VersionInfo number for RC4Header " + _minorVersionNo);
                }
                _salt = FilePassRecord.Read(in1, 16);
                _encryptedVerifier     = FilePassRecord.Read(in1, 16);
                _encryptedVerifierHash = FilePassRecord.Read(in1, 16);
            }
コード例 #4
0
ファイル: CFRuleRecord.cs プロジェクト: thachgiasoft/shuijin
        public CFRuleRecord(RecordInputStream in1)
        {
            field_1_condition_type      = (byte)in1.ReadByte();
            field_2_comparison_operator = (byte)in1.ReadByte();
            int field_3_formula1_len = in1.ReadUShort();
            int field_4_formula2_len = in1.ReadUShort();

            field_5_options  = in1.ReadInt();
            field_6_not_used = in1.ReadShort();

            if (ContainsFontFormattingBlock)
            {
                fontFormatting = new FontFormatting(in1);
            }

            if (ContainsBorderFormattingBlock)
            {
                borderFormatting = new BorderFormatting(in1);
            }

            if (ContainsPatternFormattingBlock)
            {
                patternFormatting = new PatternFormatting(in1);
            }
            field_17_formula1 = FR.Formula.Read(field_3_formula1_len, in1);
            field_18_formula2 = FR.Formula.Read(field_4_formula2_len, in1);
        }
コード例 #5
0
ファイル: LabelRecord.cs プロジェクト: Reinakumiko/npoi
        /**
         * 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 = "";
            }
            if (in1.Remaining > 0)
            {
                logger.Log(POILogger.INFO, "LabelRecord data remains: " +in1.Remaining +
                " : " + HexDump.ToHex(in1.ReadRemainder()));
            }
        }
コード例 #6
0
ファイル: RKRecord.cs プロジェクト: ChiangHanLung/PIC_VDS
    /**
     * Constructs a RK record and Sets its fields appropriately.
     * @param in the RecordInputstream to Read the record from
     */

    public RKRecord(RecordInputStream in1)
    {
        field_1_row = in1.ReadUShort();
        field_2_col = in1.ReadUShort();
        field_3_xf_index = in1.ReadShort();
        field_4_rk_number = in1.ReadInt();
    }
コード例 #7
0
        /**
         * Constructs an LabelSST record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public LabelSSTRecord(RecordInputStream in1)
        {
            field_1_row = in1.ReadUShort();
            field_2_column = in1.ReadUShort();
            field_3_xf_index = in1.ReadShort();
            field_4_sst_index = in1.ReadInt();
        }
コード例 #8
0
ファイル: DConRefRecord.cs プロジェクト: FilRip/IMDEV.Commun
        /**
         * Read Constructor.
         *
         * @param inStream RecordInputStream containing a DConRefRecord structure.
         */
        public DConRefRecord(RecordInputStream inStream)
        {
            if (inStream.Sid != sid)
            {
                throw new RecordFormatException("Wrong sid: " + inStream.Sid);
            }

            firstRow = inStream.ReadUShort();
            lastRow  = inStream.ReadUShort();
            firstCol = inStream.ReadUByte();
            lastCol  = inStream.ReadUByte();

            charCount = inStream.ReadUShort();
            charType  = inStream.ReadUByte() & 0x01; //first bit only.

            // byteLength depends on whether we are using single- or double-byte chars.
            int byteLength = charCount * (charType + 1);

            path = new byte[byteLength];
            inStream.ReadFully(path);

            if (path[0] == 0x02)
            {
                _unused = inStream.ReadRemainder();
            }
        }
コード例 #9
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();
            }
            else if (in1.Available() == 2 && length == 0)
            {
                // If there's no author, may be double padded
                field_7_padding = (byte)in1.ReadByte();
                in1.ReadByte();
            }
        }
コード例 #10
0
        public ExtendedPivotTableViewFieldsRecord(RecordInputStream in1)
        {

            grbit1 = in1.ReadInt();
            grbit2 = in1.ReadUByte();
            citmShow = in1.ReadUByte();
            isxdiSort = in1.ReadUShort();
            isxdiShow = in1.ReadUShort();
            // This record seems to have different valid encodings
		    switch (in1.Remaining) {
			    case 0:
				    // as per "Microsoft Excel Developer's Kit" book
				    // older version of SXVDEX - doesn't seem to have a sub-total name
				    reserved1 = 0;
				    reserved2 = 0;
				    subName = null;
				    return;
			    case 10:
				    // as per "MICROSOFT OFFICE EXCEL 97-2007 BINARY FILE FORMAT SPECIFICATION" pdf
				    break;
			    default:
				    throw new RecordFormatException("Unexpected remaining size (" + in1.Remaining + ")");
		    }
            int cchSubName = in1.ReadUShort();
            reserved1 = in1.ReadInt();
            reserved2 = in1.ReadInt();
            if (cchSubName != STRING_NOT_PRESENT_LEN)
            {
                subName = in1.ReadUnicodeLEString(cchSubName);
            }
        }
コード例 #11
0
        /**
         * Constructs a BoolErr record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public BoolErrRecord(RecordInputStream in1)
        {
            field_1_row = in1.ReadUShort();
            field_2_column = in1.ReadUShort();
            field_3_xf_index = in1.ReadShort();
            field_4_bBoolErr = (byte)in1.ReadByte();
            field_5_fError = (byte)in1.ReadByte();
        }
コード例 #12
0
ファイル: ArrayRecord.cs プロジェクト: ChiangHanLung/PIC_VDS
        public ArrayRecord(RecordInputStream in1)
            : base(in1)
        {

            _options = in1.ReadUShort();
            _field3notUsed = in1.ReadInt();
            int formulaLen = in1.ReadUShort();
            _formulaTokens = Ptg.ReadTokens(formulaLen, in1);
        }
コード例 #13
0
ファイル: ArrayRecord.cs プロジェクト: babywzazy/Server
 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);
 }
コード例 #14
0
        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);
        }
コード例 #15
0
        public TableStylesRecord(RecordInputStream in1)
        {
            rt       = in1.ReadUShort();
            grbitFrt = in1.ReadUShort();
            in1.ReadFully(unused);
            cts = in1.ReadInt();
            int cchDefListStyle  = in1.ReadUShort();
            int cchDefPivotStyle = in1.ReadUShort();

            rgchDefListStyle  = in1.ReadUnicodeLEString(cchDefListStyle);
            rgchDefPivotStyle = in1.ReadUnicodeLEString(cchDefPivotStyle);
        }
コード例 #16
0
ファイル: TableStylesRecord.cs プロジェクト: xoposhiy/npoi
        public TableStylesRecord(RecordInputStream in1)
        {
            rt = in1.ReadUShort();
            grbitFrt = in1.ReadUShort();
            in1.ReadFully(unused);
            cts = in1.ReadInt();
            int cchDefListStyle = in1.ReadUShort();
            int cchDefPivotStyle = in1.ReadUShort();

            rgchDefListStyle = in1.ReadUnicodeLEString(cchDefListStyle);
            rgchDefPivotStyle = in1.ReadUnicodeLEString(cchDefPivotStyle);
        }
コード例 #17
0
ファイル: CFRuleRecord.cs プロジェクト: zzy092/npoi
        public CFRuleRecord(RecordInputStream in1)
        {
            ConditionType       = ((byte)in1.ReadByte());
            ComparisonOperation = ((byte)in1.ReadByte());
            int field_3_formula1_len = in1.ReadUShort();
            int field_4_formula2_len = in1.ReadUShort();

            ReadFormatOptions(in1);

            // "You may not use unions, intersections or array constants in Conditional Formatting criteria"
            Formula1 = (Formula.Read(field_3_formula1_len, in1));
            Formula2 = (Formula.Read(field_4_formula2_len, in1));
        }
コード例 #18
0
ファイル: SelectionRecord.cs プロジェクト: xoposhiy/npoi
        /// <summary>
        /// Constructs a Selection record and Sets its fields appropriately.
        /// </summary>
        /// <param name="in1">the RecordInputstream to Read the record from</param>
        public SelectionRecord(RecordInputStream in1)
        {
            field_1_pane = (byte)in1.ReadByte();
            
            field_2_row_active_cell = in1.ReadUShort();
            field_3_col_active_cell = in1.ReadShort();
            field_4_ref_active_cell = in1.ReadShort();
            int field_5_num_refs = in1.ReadUShort();

            field_6_refs = new CellRangeAddress8Bit[field_5_num_refs];
            for (int i = 0; i < field_5_num_refs; i++)
            {
                field_6_refs[i] = new CellRangeAddress8Bit(in1);
            }
        }
コード例 #19
0
        /// <summary>
        /// Constructs a Selection record and Sets its fields appropriately.
        /// </summary>
        /// <param name="in1">the RecordInputstream to Read the record from</param>
        public SelectionRecord(RecordInputStream in1)
        {
            field_1_pane = (byte)in1.ReadByte();

            field_2_row_active_cell = in1.ReadUShort();
            field_3_col_active_cell = in1.ReadShort();
            field_4_ref_active_cell = in1.ReadShort();
            int field_5_num_refs = in1.ReadUShort();

            field_6_refs = new CellRangeAddress8Bit[field_5_num_refs];
            for (int i = 0; i < field_5_num_refs; i++)
            {
                field_6_refs[i] = new CellRangeAddress8Bit(in1);
            }
        }
コード例 #20
0
        /**
         * Constructs a BoolErr record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public BoolErrRecord(RecordInputStream in1)
            : base(in1)
        {
            switch (in1.Remaining)
            {
                case 2:
                    _value = in1.ReadByte();
                    break;
                case 3:
                    _value = in1.ReadUShort();
                    break;
                default:
                    throw new RecordFormatException("Unexpected size ("
                            + in1.Remaining + ") for BOOLERR record.");
            }
            int flag = in1.ReadUByte();
            switch (flag)
            {
                case 0:
                    _isError = false;
                    break;
                case 1:
                    _isError = true;
                    break;
                default:
                    throw new RecordFormatException("Unexpected isError flag ("
                            + flag + ") for BOOLERR record.");
            }
        }
コード例 #21
0
ファイル: MulRKRecord.cs プロジェクト: yesonsik/npoi
        /**
         * Constructs a MulRK record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public MulRKRecord(RecordInputStream in1)
        {
            field_1_row       = in1.ReadUShort();
            field_2_first_col = in1.ReadShort();
            field_3_rks       = RkRec.ParseRKs(in1);
            field_4_last_col  = in1.ReadShort();
        }
コード例 #22
0
ファイル: MulBlankRecord.cs プロジェクト: xoposhiy/npoi
        /**
         * Constructs a MulBlank record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public MulBlankRecord(RecordInputStream in1)
        {
            _row = in1.ReadUShort();
            _first_col = in1.ReadShort();
            _xfs = ParseXFs(in1);
            _last_col = in1.ReadShort();
        }
コード例 #23
0
ファイル: MulBlankRecord.cs プロジェクト: zanhaipeng/npoi
        /**
         * Constructs a MulBlank record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public MulBlankRecord(RecordInputStream in1)
        {
            _row       = in1.ReadUShort();
            _first_col = in1.ReadShort();
            _xfs       = ParseXFs(in1);
            _last_col  = in1.ReadShort();
        }
コード例 #24
0
        /**
         * Constructs a MulBlank record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public MulBlankRecord(RecordInputStream in1)
        {
            field_1_row = in1.ReadUShort();
            field_2_first_col = in1.ReadShort();
            field_3_xfs = ParseXFs(in1);
            field_4_last_col = in1.ReadShort();
        }
コード例 #25
0
        /**
         * Constructs a MulRK record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public MulRKRecord(RecordInputStream in1)
        {
            field_1_row = in1.ReadUShort();
            field_2_first_col = in1.ReadShort();
            field_3_rks = ParseRKs(in1);
            field_4_last_col = in1.ReadShort();
        }
コード例 #26
0
ファイル: FeatRecord.cs プロジェクト: hanwangkun/npoi
        public FeatRecord(RecordInputStream in1)
        {
            futureHeader = new FtrHeader(in1);

            isf_sharedFeatureType = in1.ReadShort();
            reserved1 = (byte)in1.ReadByte();
            reserved2 = in1.ReadInt();
            int cref = in1.ReadUShort();
            cbFeatData = in1.ReadInt();
            reserved3 = in1.ReadShort();

            cellRefs = new CellRangeAddress[cref];
            for (int i = 0; i < cellRefs.Length; i++)
            {
                cellRefs[i] = new CellRangeAddress(in1);
            }

            switch (isf_sharedFeatureType)
            {
                case FeatHdrRecord.SHAREDFEATURES_ISFPROTECTION:
                    sharedFeature = new FeatProtection(in1);
                    break;
                case FeatHdrRecord.SHAREDFEATURES_ISFFEC2:
                    sharedFeature = new FeatFormulaErr2(in1);
                    break;
                case FeatHdrRecord.SHAREDFEATURES_ISFFACTOID:
                    sharedFeature = new FeatSmartTag(in1);
                    break;
                default:
                    System.Console.WriteLine("Unknown Shared Feature " + isf_sharedFeatureType + " found!");
                    break;
            }
        }
コード例 #27
0
        /**
         * Constructs a MulBlank record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public MulBlankRecord(RecordInputStream in1)
        {
            field_1_row       = in1.ReadUShort();
            field_2_first_col = in1.ReadShort();
            field_3_xfs       = ParseXFs(in1);
            field_4_last_col  = in1.ReadShort();
        }
コード例 #28
0
ファイル: BoolErrRecord.cs プロジェクト: zzy092/npoi
        /**
         * Constructs a BoolErr record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public BoolErrRecord(RecordInputStream in1)
            : base(in1)
        {
            switch (in1.Remaining)
            {
            case 2:
                _value = in1.ReadByte();
                break;

            case 3:
                _value = in1.ReadUShort();
                break;

            default:
                throw new RecordFormatException("Unexpected size ("
                                                + in1.Remaining + ") for BOOLERR record.");
            }
            int flag = in1.ReadUByte();

            switch (flag)
            {
            case 0:
                _isError = false;
                break;

            case 1:
                _isError = true;
                break;

            default:
                throw new RecordFormatException("Unexpected isError flag ("
                                                + flag + ") for BOOLERR record.");
            }
        }
コード例 #29
0
ファイル: OldCellRecord.cs プロジェクト: Reinakumiko/npoi
        private short field_3_xf_index;   // Biff 3+

        protected OldCellRecord(RecordInputStream in1, bool isBiff2)
        {
            this.sid = in1.Sid;
            this.isBiff2 = isBiff2;
            field_1_row = in1.ReadUShort();
            field_2_column = in1.ReadShort();

            if (isBiff2)
            {
                field_3_cell_attrs = in1.ReadUShort() << 8;
                field_3_cell_attrs += in1.ReadUByte();
            }
            else
            {
                field_3_xf_index = in1.ReadShort();
            }
        }
コード例 #30
0
ファイル: NoteRecord.cs プロジェクト: JnS-Software-LLC/npoi
        /**
         * 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();
		    }
        }
コード例 #31
0
        private short field_3_xf_index; // Biff 3+

        protected OldCellRecord(RecordInputStream in1, bool isBiff2)
        {
            this.sid       = in1.Sid;
            this.isBiff2   = isBiff2;
            field_1_row    = in1.ReadUShort();
            field_2_column = in1.ReadShort();

            if (isBiff2)
            {
                field_3_cell_attrs  = in1.ReadUShort() << 8;
                field_3_cell_attrs += in1.ReadUByte();
            }
            else
            {
                field_3_xf_index = in1.ReadShort();
            }
        }
コード例 #32
0
ファイル: CellRangeAddress.cs プロジェクト: WPG/npoi
 private static int ReadUShortAndCheck(RecordInputStream in1)
 {
     if (in1.Remaining < ENCODED_SIZE)
     {
         // Ran out of data
         throw new Exception("Ran out of data readin1g CellRangeAddress");
     }
     return in1.ReadUShort();
 }
コード例 #33
0
        /**
         * @param in the RecordInputstream to read the record from
         */
        public CellRangeAddressList(RecordInputStream in1)
        {
            int nItems = in1.ReadUShort();
            _list = new ArrayList(nItems);

            for (int k = 0; k < nItems; k++)
            {
                _list.Add(new CellRangeAddress(in1));
            }
        }
コード例 #34
0
ファイル: WriteAccessRecord.cs プロジェクト: yesonsik/npoi
        /**
         * Constructs a WriteAccess record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public WriteAccessRecord(RecordInputStream in1)
        {
            if (in1.Remaining > DATA_SIZE)
            {
                throw new RecordFormatException("Expected data size (" + DATA_SIZE + ") but got ("
                                                + in1.Remaining + ")");
            }
            // The string is always 112 characters (padded with spaces), therefore
            // this record can not be continued.

            int nChars      = in1.ReadUShort();
            int is16BitFlag = in1.ReadUByte();

            if (nChars > DATA_SIZE || (is16BitFlag & 0xFE) != 0)
            {
                // String header looks wrong (probably missing)
                // OOO doc says this is optional anyway.
                // reconstruct data
                byte[] data = new byte[3 + in1.Remaining];
                LittleEndian.PutUShort(data, 0, nChars);
                LittleEndian.PutByte(data, 2, is16BitFlag);
                in1.ReadFully(data, 3, data.Length - 3);
                char[] data1 = new char[data.Length];
                for (int i = 0; i < data.Length; i++)
                {
                    data1[i] = (char)data[i];
                }
                String rawValue = new String(data1);
                Username = rawValue.Trim();
                return;
            }

            String rawText;

            if ((is16BitFlag & 0x01) == 0x00)
            {
                rawText = StringUtil.ReadCompressedUnicode(in1, nChars);
            }
            else
            {
                rawText = StringUtil.ReadUnicodeLE(in1, nChars);
            }
            field_1_username = rawText.Trim();

            // consume padding
            int padSize = in1.Remaining;

            while (padSize > 0)
            {
                // in some cases this seems to be garbage (non spaces)
                in1.ReadUByte();
                padSize--;
            }
        }
コード例 #35
0
        /**
         * Constructs a SeriesList record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public SeriesListRecord(RecordInputStream in1)
        {
            int nItems = in1.ReadUShort();
    	    short[] ss = new short[nItems];
    	    for (int i = 0; i < nItems; i++) {
			    ss[i] = in1.ReadShort();
    			
		    }
            field_1_seriesNumbers = ss;

        }
コード例 #36
0
ファイル: RowRecord.cs プロジェクト: ChiangHanLung/PIC_VDS
        /**
         * Constructs a Row record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public RowRecord(RecordInputStream in1)
        {
            field_1_row_number = in1.ReadUShort();
            field_2_first_col = in1.ReadShort();
            field_3_last_col = in1.ReadShort();
            field_4_height = in1.ReadShort();
            field_5_optimize = in1.ReadShort();
            field_6_reserved = in1.ReadShort();
            field_7_option_flags = in1.ReadShort();
            field_8_xf_index = in1.ReadShort();
        }
コード例 #37
0
ファイル: RowRecord.cs プロジェクト: purehzj/npoi-1
        /**
         * Constructs a Row record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public RowRecord(RecordInputStream in1)
        {
            field_1_row_number   = in1.ReadUShort();
            field_2_first_col    = in1.ReadShort();
            field_3_last_col     = in1.ReadShort();
            field_4_height       = in1.ReadShort();
            field_5_optimize     = in1.ReadShort();
            field_6_reserved     = in1.ReadShort();
            field_7_option_flags = in1.ReadShort();
            field_8_xf_index     = in1.ReadShort();
        }
コード例 #38
0
ファイル: DBCellRecord.cs プロジェクト: ChiangHanLung/PIC_VDS
        /**
         * Constructs a DBCellRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */
        public DBCellRecord(RecordInputStream in1)
        {
            field_1_row_offset = in1.ReadUShort();
            int size = in1.Remaining;
            field_2_cell_offsets = new short[size / 2];

            for (int i = 0; i < field_2_cell_offsets.Length; i++)
            {
                field_2_cell_offsets[i] = in1.ReadShort();
            }
        }
コード例 #39
0
        /**
         * Constructs a DBCellRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */
        public DBCellRecord(RecordInputStream in1)
        {
            field_1_row_offset = in1.ReadUShort();
            int size = in1.Remaining;

            field_2_cell_offsets = new short[size / 2];

            for (int i = 0; i < field_2_cell_offsets.Length; i++)
            {
                field_2_cell_offsets[i] = in1.ReadShort();
            }
        }
コード例 #40
0
ファイル: MergeCellsRecord.cs プロジェクト: xoposhiy/npoi
        /**
         * Constructs a MergedCellsRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public MergeCellsRecord(RecordInputStream in1)
        {
            int nRegions = in1.ReadUShort();
    	    CellRangeAddress[] cras = new CellRangeAddress[nRegions];
    	    for (int i = 0; i < nRegions; i++) 
            {
			    cras[i] = new CellRangeAddress(in1);
		    }
    	    _numberOfRegions = nRegions;
    	    _startIndex = 0;
    	    _regions = cras;
        }
コード例 #41
0
ファイル: ColumnInfoRecord.cs プロジェクト: babywzazy/Server
 /**
  * Constructs a ColumnInfo record and Sets its fields appropriately
  * @param in the RecordInputstream to Read the record from
  */
 public ColumnInfoRecord(RecordInputStream in1)
 {
     field_1_first_col = in1.ReadUShort();
     field_2_last_col = in1.ReadUShort();
     field_3_col_width = in1.ReadShort();
     field_4_xf_index = in1.ReadShort();
     field_5_options = in1.ReadShort();
     switch (in1.Remaining)
     {
         case 2: // usual case
             field_6_reserved = in1.ReadShort();
             break;
         case 1:
             // often COLINFO Gets encoded 1 byte short
             // shouldn't matter because this field Is Unused
             field_6_reserved = in1.ReadByte();
             break;
         default:
             throw new Exception("Unusual record size remaining=(" + in1.Remaining + ")");
     }
 }
コード例 #42
0
ファイル: ColumnInfoRecord.cs プロジェクト: xoposhiy/npoi
        /**
         * Constructs a ColumnInfo record and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public ColumnInfoRecord(RecordInputStream in1)
        {
            _first_col = in1.ReadUShort();
            _last_col = in1.ReadUShort();
            _col_width = in1.ReadUShort();
            _xf_index = in1.ReadUShort();
            _options = in1.ReadUShort();
            switch (in1.Remaining)
            {
                case 2: // usual case
                    field_6_reserved = in1.ReadUShort();
                    break;
                case 1:
                    // often COLINFO Gets encoded 1 byte short
                    // shouldn't matter because this field Is Unused
                    field_6_reserved = in1.ReadByte();
                    break;
                case 0:
                    // According to bugzilla 48332,
                    // "SoftArtisans OfficeWriter for Excel" totally skips field 6
                    // Excel seems to be OK with this, and assumes zero.
                    field_6_reserved = 0;
                    break;
                default:
                    throw new Exception("Unusual record size remaining=(" + in1.Remaining + ")");
            }
        }
コード例 #43
0
        public FilePassRecord(RecordInputStream in1)
        {
            _encryptionType = in1.ReadUShort();

            switch (_encryptionType)
            {
            case ENCRYPTION_XOR:
                throw new RecordFormatException("HSSF does not currently support XOR obfuscation");

            case ENCRYPTION_OTHER:
                // handled below
                break;

            default:
                throw new RecordFormatException("Unknown encryption type " + _encryptionType);
            }
            _encryptionInfo = in1.ReadUShort();
            switch (_encryptionInfo)
            {
            case ENCRYPTION_OTHER_RC4:
                // handled below
                break;

            case ENCRYPTION_OTHER_CAPI_2:
            case ENCRYPTION_OTHER_CAPI_3:
                throw new RecordFormatException(
                          "HSSF does not currently support CryptoAPI encryption");

            default:
                throw new RecordFormatException("Unknown encryption info " + _encryptionInfo);
            }
            _minorVersionNo = in1.ReadUShort();
            if (_minorVersionNo != 1)
            {
                throw new RecordFormatException("Unexpected VersionInfo number for RC4Header " + _minorVersionNo);
            }
            _docId    = Read(in1, 16);
            _saltData = Read(in1, 16);
            _saltHash = Read(in1, 16);
        }
コード例 #44
0
ファイル: ColumnInfoRecord.cs プロジェクト: yesonsik/npoi
        /**
         * Constructs a ColumnInfo record and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public ColumnInfoRecord(RecordInputStream in1)
        {
            _first_col = in1.ReadUShort();
            _last_col  = in1.ReadUShort();
            _col_width = in1.ReadUShort();
            _xf_index  = in1.ReadUShort();
            _options   = in1.ReadUShort();
            switch (in1.Remaining)
            {
            case 2:     // usual case
                field_6_reserved = in1.ReadUShort();
                break;

            case 1:
                // often COLINFO Gets encoded 1 byte short
                // shouldn't matter because this field Is Unused
                field_6_reserved = in1.ReadByte();
                break;

            case 0:
                // According to bugzilla 48332,
                // "SoftArtisans OfficeWriter for Excel" totally skips field 6
                // Excel seems to be OK with this, and assumes zero.
                field_6_reserved = 0;
                break;

            default:
                throw new Exception("Unusual record size remaining=(" + in1.Remaining + ")");
            }
        }
コード例 #45
0
        /**
         * Constructs a WriteAccess record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public WriteAccessRecord(RecordInputStream in1)
        {
            if (in1.Remaining > DATA_SIZE)
            {
                throw new RecordFormatException("Expected data size (" + DATA_SIZE + ") but got ("
                        + in1.Remaining + ")");
            }
            // The string is always 112 characters (padded with spaces), therefore
            // this record can not be continued.

            int nChars = in1.ReadUShort();
            int is16BitFlag = in1.ReadUByte();
            if (nChars > DATA_SIZE || (is16BitFlag & 0xFE) != 0)
            {
                // String header looks wrong (probably missing)
                // OOO doc says this is optional anyway.
                // reconstruct data
                byte[] data = new byte[3 + in1.Remaining];
                LittleEndian.PutUShort(data, 0, nChars);
                LittleEndian.PutByte(data, 2, is16BitFlag);
                in1.ReadFully(data, 3, data.Length - 3);
                char[] data1=new char[data.Length];
                for (int i = 0; i < data.Length; i++)
                {
                    data1[i] = (char)data[i];
                }
                String rawValue = new String(data1);
                Username = rawValue.Trim();
                return;
            }

            String rawText;
            if ((is16BitFlag & 0x01) == 0x00)
            {
                rawText = StringUtil.ReadCompressedUnicode(in1, nChars);
            }
            else
            {
                rawText = StringUtil.ReadUnicodeLE(in1, nChars);
            }
            field_1_username = rawText.Trim();

            // consume padding
            int padSize = in1.Remaining;
            while (padSize > 0)
            {
                // in some cases this seems to be garbage (non spaces)
                in1.ReadUByte();
                padSize--;
            }

        }
コード例 #46
0
        /**
         * Constructs a MergedCellsRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public MergeCellsRecord(RecordInputStream in1)
        {
            int nRegions = in1.ReadUShort();

            CellRangeAddress[] cras = new CellRangeAddress[nRegions];
            for (int i = 0; i < nRegions; i++)
            {
                cras[i] = new CellRangeAddress(in1);
            }
            _numberOfRegions = nRegions;
            _startIndex      = 0;
            _regions         = cras;
        }
コード例 #47
0
ファイル: LabelRecord.cs プロジェクト: ChiangHanLung/PIC_VDS
        /**
         * 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 = "";
            }
        }
コード例 #48
0
        /**
         * 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 = "";
            }
        }
コード例 #49
0
        /**
         * Constructs a ColumnInfo record and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public ColumnInfoRecord(RecordInputStream in1)
        {
            field_1_first_col = in1.ReadUShort();
            field_2_last_col  = in1.ReadUShort();
            field_3_col_width = in1.ReadShort();
            field_4_xf_index  = in1.ReadShort();
            field_5_options   = in1.ReadShort();
            switch (in1.Remaining)
            {
            case 2:     // usual case
                field_6_reserved = in1.ReadShort();
                break;

            case 1:
                // often COLINFO Gets encoded 1 byte short
                // shouldn't matter because this field Is Unused
                field_6_reserved = in1.ReadByte();
                break;

            default:
                throw new Exception("Unusual record size remaining=(" + in1.Remaining + ")");
            }
        }
コード例 #50
0
 private static object ReadAConstantValue(RecordInputStream in1)
 {
     byte grbit = (byte)in1.ReadByte();
     switch (grbit)
     {
         case TYPE_EMPTY:
             in1.ReadLong(); // 8 byte 'not used' field
             return EMPTY_REPRESENTATION;
         case TYPE_NUMBER:
             return in1.ReadDouble();
         case TYPE_STRING:
             return in1.ReadUnicodeString();
         case TYPE_bool:
             return ReadBoolean(in1);
         case TYPE_ERROR_CODE:
             int errCode = in1.ReadUShort();
             // next 6 bytes are Unused
             in1.ReadUShort();
             in1.ReadInt();
             return ErrorConstant.ValueOf(errCode);
     }
     throw new Exception("Unknown grbit value (" + grbit + ")");
 }
コード例 #51
0
ファイル: FilePassRecord.cs プロジェクト: babywzazy/Server
        public FilePassRecord(RecordInputStream in1)
        {
            _encryptionType = in1.ReadUShort();

            switch (_encryptionType)
            {
                case ENCRYPTION_XOR:
                    throw new RecordFormatException("HSSF does not currently support XOR obfuscation");
                case ENCRYPTION_OTHER:
                    // handled below
                    break;
                default:
                    throw new RecordFormatException("Unknown encryption type " + _encryptionType);
            }
            _encryptionInfo = in1.ReadUShort();
            switch (_encryptionInfo)
            {
                case ENCRYPTION_OTHER_RC4:
                    // handled below
                    break;
                case ENCRYPTION_OTHER_CAPI_2:
                case ENCRYPTION_OTHER_CAPI_3:
                    throw new RecordFormatException(
                            "HSSF does not currently support CryptoAPI encryption");
                default:
                    throw new RecordFormatException("Unknown encryption info " + _encryptionInfo);
            }
            _minorVersionNo = in1.ReadUShort();
            if (_minorVersionNo != 1)
            {
                throw new RecordFormatException("Unexpected VersionInfo number for RC4Header " + _minorVersionNo);
            }
            _docId = Read(in1, 16);
            _saltData = Read(in1, 16);
            _saltHash = Read(in1, 16);
        }
コード例 #52
0
 public ChartTitleFormatRecord(RecordInputStream in1)
 {
     m_recs = in1.ReadUShort();
     int idx;
     CTFormat ctf;
     if (m_formats == null)
     {
         m_formats = new ArrayList(m_recs);
     }
     for (idx = 0; idx < m_recs; idx++)
     {
         ctf = new CTFormat(in1.ReadShort(), in1.ReadShort());
         m_formats.Add(ctf);
     }
 }
コード例 #53
0
ファイル: RowRecord.cs プロジェクト: zzy092/npoi
        /**
         * Constructs a Row record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public RowRecord(RecordInputStream in1)
        {
            field_1_row_number = in1.ReadUShort();
            if (field_1_row_number < 0)
            {
                throw new ArgumentException("Invalid row number " + field_1_row_number + " found in InputStream");
            }
            field_2_first_col    = in1.ReadShort();
            field_3_last_col     = in1.ReadShort();
            field_4_height       = in1.ReadShort();
            field_5_optimize     = in1.ReadShort();
            field_6_reserved     = in1.ReadShort();
            field_7_option_flags = in1.ReadShort();
            field_8_option_flags = in1.ReadShort();
        }
コード例 #54
0
ファイル: DataItemRecord.cs プロジェクト: hanwangkun/npoi
        public DataItemRecord(RecordInputStream in1)
        {
            isxvdData = in1.ReadUShort();
            iiftab = in1.ReadUShort();
            df = in1.ReadUShort();
            isxvd = in1.ReadUShort();
            isxvi = in1.ReadUShort();
            ifmt = in1.ReadUShort();

            name = in1.ReadString();
        }
コード例 #55
0
        /**
         * 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);
        }
コード例 #56
0
        public FilePassRecord(RecordInputStream in1)
        {
            _encryptionType = in1.ReadUShort();

            switch (_encryptionType)
            {
            case ENCRYPTION_XOR:
                _keyData = new XorKeyData();
                break;

            case ENCRYPTION_OTHER:
                _keyData = new Rc4KeyData();
                break;

            default:
                throw new RecordFormatException("Unknown encryption type " + _encryptionType);
            }

            _keyData.Read(in1);
        }
コード例 #57
0
ファイル: FeatRecord.cs プロジェクト: FilRip/IMDEV.Commun
        public FeatRecord(RecordInputStream in1)
        {
            futureHeader = new FtrHeader(in1);

            isf_sharedFeatureType = in1.ReadShort();
            reserved1             = (byte)in1.ReadByte();
            reserved2             = in1.ReadInt();
            int cref = in1.ReadUShort();

            cbFeatData = in1.ReadInt();
            reserved3  = in1.ReadShort();

            cellRefs = new CellRangeAddress[cref];
            for (int i = 0; i < cellRefs.Length; i++)
            {
                cellRefs[i] = new CellRangeAddress(in1);
            }

            switch (isf_sharedFeatureType)
            {
            case FeatHdrRecord.SHAREDFEATURES_ISFPROTECTION:
                sharedFeature = new FeatProtection(in1);
                break;

            case FeatHdrRecord.SHAREDFEATURES_ISFFEC2:
                sharedFeature = new FeatFormulaErr2(in1);
                break;

            case FeatHdrRecord.SHAREDFEATURES_ISFFACTOID:
                sharedFeature = new FeatSmartTag(in1);
                break;

            default:
                logger.Log(POILogger.ERROR, "Unknown Shared Feature " + isf_sharedFeatureType + " found!");
                break;
            }
        }
コード例 #58
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);
                }
            }
        }
コード例 #59
0
        /**
         * Constructs a DefaultColumnWidth record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public DefaultColWidthRecord(RecordInputStream in1)
        {
            field_1_col_width = in1.ReadUShort();
        }
コード例 #60
0
 public Break(RecordInputStream in1)
 {
     main    = in1.ReadUShort() - 1;
     subFrom = in1.ReadUShort();
     subTo   = in1.ReadUShort();
 }