예제 #1
0
파일: DVRecord.cs 프로젝트: zanhaipeng/npoi
        public DVRecord(int validationType, int operator1, int errorStyle, bool emptyCellAllowed,
                        bool suppressDropDownArrow, bool isExplicitList,
                        bool showPromptBox, String promptTitle, String promptText,
                        bool showErrorBox, String errorTitle, String errorText,
                        Ptg[] formula1, Ptg[] formula2,
                        CellRangeAddressList regions)
        {
            int flags = 0;

            flags         = opt_data_type.SetValue(flags, validationType);
            flags         = opt_condition_operator.SetValue(flags, operator1);
            flags         = opt_error_style.SetValue(flags, errorStyle);
            flags         = opt_empty_cell_allowed.SetBoolean(flags, emptyCellAllowed);
            flags         = opt_suppress_dropdown_arrow.SetBoolean(flags, suppressDropDownArrow);
            flags         = opt_string_list_formula.SetBoolean(flags, isExplicitList);
            flags         = opt_show_prompt_on_cell_selected.SetBoolean(flags, showPromptBox);
            flags         = opt_show_error_on_invalid_value.SetBoolean(flags, showErrorBox);
            _option_flags = flags;
            _promptTitle  = ResolveTitleText(promptTitle);
            _promptText   = ResolveTitleText(promptText);
            _errorTitle   = ResolveTitleText(errorTitle);
            _errorText    = ResolveTitleText(errorText);
            _formula1     = NPOI.SS.Formula.Formula.Create(formula1);
            _formula2     = NPOI.SS.Formula.Formula.Create(formula2);
            _regions      = regions;
        }
예제 #2
0
        public OldFormulaRecord(RecordInputStream ris) :
            base(ris, ris.Sid == biff2_sid)
        {
            ;

            if (IsBiff2)
            {
                field_4_value = ris.ReadDouble();
            }
            else
            {
                long valueLongBits = ris.ReadLong();
                specialCachedValue = SpecialCachedValue.Create(valueLongBits);
                if (specialCachedValue == null)
                {
                    field_4_value = BitConverter.Int64BitsToDouble(valueLongBits);
                }
            }

            if (IsBiff2)
            {
                field_5_options = (short)ris.ReadUByte();
            }
            else
            {
                field_5_options = ris.ReadShort();
            }

            int expression_len = ris.ReadShort();
            int nBytesAvailable = ris.Available();
            field_6_Parsed_expr = Formula.Read(expression_len, ris, nBytesAvailable);
        }
예제 #3
0
        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);
        }
예제 #4
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);
        }
예제 #5
0
 public ArrayRecord(NPOI.SS.Formula.Formula formula, CellRangeAddress8Bit range)
     : base(range)
 {
     _options = 0; //YK: Excel 2007 leaves this field unset
     _field3notUsed = 0;
     _formula = formula;
 }
예제 #6
0
        /**
         * @param in the RecordInputstream to Read the record from
         */

        public SharedFormulaRecord(RecordInputStream in1)
            : base(in1)
        {
            field_5_reserved = in1.ReadShort();
            int field_6_expression_len = in1.ReadShort();
            int nAvailableBytes = in1.Available();
            field_7_parsed_expr = NPOI.SS.Formula.Formula.Read(field_6_expression_len, in1, nAvailableBytes);
        }
예제 #7
0
 private CFRuleRecord(byte conditionType, ComparisonOperator comparisonOperation, Ptg[] formula1, Ptg[] formula2)
     : this(conditionType, comparisonOperation)
 {
     //field_1_condition_type = CONDITION_TYPE_CELL_VALUE_IS;
     //field_2_comparison_operator = (byte)comparisonOperation;
     field_17_formula1 = FR.Formula.Create(formula1);
     field_18_formula2 = FR.Formula.Create(formula2);
 }
예제 #8
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);
 }
예제 #9
0
        /**
         * @param in the RecordInputstream to Read the record from
         */

        public SharedFormulaRecord(RecordInputStream in1)
            : base(in1)
        {
            field_5_reserved = in1.ReadShort();
            int field_6_expression_len = in1.ReadShort();
            int nAvailableBytes        = in1.Available();

            field_7_parsed_expr = NPOI.SS.Formula.Formula.Read(field_6_expression_len, in1, nAvailableBytes);
        }
예제 #10
0
파일: BRAIRecord.cs 프로젝트: 89sos98/npoi
        /**
         * Constructs a LinkedData record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public BRAIRecord(RecordInputStream in1)
        {
            field_1_linkType = (byte)in1.ReadByte();
            field_2_referenceType = (byte)in1.ReadByte();
            field_3_options = in1.ReadShort();
            field_4_indexNumberFmtRecord = in1.ReadShort();
            int encodedTokenLen = in1.ReadUShort();
            field_5_formulaOfLink = Formula.Read(encodedTokenLen, in1);
        }
예제 #11
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);
        }
예제 #12
0
파일: NameRecord.cs 프로젝트: zzy092/npoi
        /** Creates new NameRecord */
        public NameRecord()
        {
            field_13_name_definition = SSFormula.Formula.Create(Ptg.EMPTY_PTG_ARRAY);

            field_12_name_text        = "";
            field_14_custom_menu_text = "";
            field_15_description_text = "";
            field_16_help_topic_text  = "";
            field_17_status_bar_text  = "";
        }
예제 #13
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 = NPOI.SS.Formula.Formula.Read(field_7_expression_len, in1, in1.Available());
        }
예제 #14
0
파일: NameRecord.cs 프로젝트: zzy092/npoi
        /**
         * Constructs a Name record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */
        public NameRecord(RecordInputStream ris)
        {
            byte[]             remainder = ris.ReadAllContinuedRemainder();
            ILittleEndianInput in1       = new LittleEndianByteArrayInputStream(remainder);

            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 = StringUtil.ReadUnicodeLE(in1, field_3_length_name_text);
                }
                else
                {
                    field_12_name_text = StringUtil.ReadCompressedUnicode(in1, 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 = StringUtil.ReadCompressedUnicode(in1, field_7_length_custom_menu);
            field_15_description_text = StringUtil.ReadCompressedUnicode(in1, field_8_length_description_text);
            field_16_help_topic_text  = StringUtil.ReadCompressedUnicode(in1, field_9_length_help_topic_text);
            field_17_status_bar_text  = StringUtil.ReadCompressedUnicode(in1, field_10_length_status_bar_text);
        }
예제 #15
0
        /** Creates new CFRuleRecord */
        private CFRuleRecord(byte conditionType, ComparisonOperator comparisonOperation)
        {
            field_1_condition_type      = conditionType;
            field_2_comparison_operator = (byte)comparisonOperation;

            // Set modification flags to 1: by default options are not modified
            field_5_options = modificationBits.SetValue(field_5_options, -1);
            // Set formatting block flags to 0 (no formatting blocks)
            field_5_options = fmtBlockBits.SetValue(field_5_options, 0);
            field_5_options = Undocumented.Clear(field_5_options);

            //TODO:: check what's this field used for
            field_6_not_used = unchecked ((short)0x8002); // Excel seems to Write this value, but it doesn't seem to care what it Reads
            fontFormatting   = null;
            //field_8_align_text_break = 0;
            //field_9_align_text_rotation_angle = 0;
            //field_10_align_indentation = 0;
            //field_11_relative_indentation = 0;
            //field_12_not_used = 0;
            borderFormatting  = null;
            patternFormatting = null;
            field_17_formula1 = FR.Formula.Create(Ptg.EMPTY_PTG_ARRAY);
            field_18_formula2 = FR.Formula.Create(Ptg.EMPTY_PTG_ARRAY);
        }
예제 #16
0
 private SharedFormulaRecord(CellRangeAddress8Bit range):
     base(range)
 {
     field_7_parsed_expr = Formula.Create(Ptg.EMPTY_PTG_ARRAY);
 }
예제 #17
0
 private SharedFormulaRecord(CellRangeAddress8Bit range) :
     base(range)
 {
     field_7_parsed_expr = Formula.Create(Ptg.EMPTY_PTG_ARRAY);
 }
예제 #18
0
파일: NameRecord.cs 프로젝트: ctddjyds/npoi
        /**
         * Constructs a Name record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */
        public NameRecord(RecordInputStream ris)
        {
            byte[] remainder = ris.ReadAllContinuedRemainder();
            ILittleEndianInput in1 = new LittleEndianByteArrayInputStream(remainder);
            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 = StringUtil.ReadUnicodeLE(in1, field_3_length_name_text);
			    } else {
                    field_12_name_text = StringUtil.ReadCompressedUnicode(in1, 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 = StringUtil.ReadCompressedUnicode(in1, field_7_length_custom_menu);
            field_15_description_text = StringUtil.ReadCompressedUnicode(in1, field_8_length_description_text);
            field_16_help_topic_text = StringUtil.ReadCompressedUnicode(in1, field_9_length_help_topic_text);
            field_17_status_bar_text = StringUtil.ReadCompressedUnicode(in1, field_10_length_status_bar_text);

        }
예제 #19
0
        private byte[] all_data; //if formula support is not enabled then
        //we'll just store/reSerialize

        /** Creates new FormulaRecord */

        public FormulaRecord()
        {
            field_8_parsed_expr = NPOI.SS.Formula.Formula.Create(Ptg.EMPTY_PTG_ARRAY);
        }
예제 #20
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 = NPOI.SS.Formula.Formula.Read(formulaLen, in1, nBytesRemaining);
        }
예제 #21
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);
                }
            }
        }
예제 #22
0
 public void SetParsedExpression(Ptg[] ptgs)
 {
     field_5_name_definition = Formula.Create(ptgs);
 }
예제 #23
0
파일: Formula.cs 프로젝트: hanwangkun/npoi
 /**
  * Gets the {@link Ptg} array from the supplied {@link Formula}. 
  * Handles <code>null</code>s OK.
  * 
  * @param formula may be <code>null</code>
  * @return possibly <code>null</code> (if the supplied <c>formula</c> is <code>null</code>)
  */
 public static Ptg[] GetTokens(Formula formula)
 {
     if (formula == null)
     {
         return null;
     }
     return formula.Tokens;
 }
예제 #24
0
 public ArrayRecord(NPOI.SS.Formula.Formula formula, CellRangeAddress8Bit range) : base(range)
 {
     _options       = 0; //YK: Excel 2007 leaves this field unset
     _field3notUsed = 0;
     _formula       = formula;
 }
예제 #25
0
 public void SetParsedExpression(Ptg[] ptgs)
 {
     field_8_parsed_expr = NPOI.SS.Formula.Formula.Create(ptgs);
 }
예제 #26
0
 private CFRuleRecord(byte conditionType, ComparisonOperator comparisonOperation, Ptg[] formula1, Ptg[] formula2)
     :this(conditionType, comparisonOperation)
 {
     
     //field_1_condition_type = CONDITION_TYPE_CELL_VALUE_IS;
     //field_2_comparison_operator = (byte)comparisonOperation;
     field_17_formula1 = FR.Formula.Create(formula1);
     field_18_formula2 = FR.Formula.Create(formula2);
 }
예제 #27
0
 public void SetParsedExpression(Ptg[] ptgs)
 {
     field_8_parsed_expr = NPOI.SS.Formula.Formula.Create(ptgs);
 }
예제 #28
0
 //we'll just store/reSerialize
 /** Creates new FormulaRecord */
 public FormulaRecord()
 {
     field_8_parsed_expr = NPOI.SS.Formula.Formula.Create(Ptg.EMPTY_PTG_ARRAY);
 }
예제 #29
0
파일: Formula.cs 프로젝트: hanwangkun/npoi
 public bool IsSame(Formula other)
 {
     return Arrays.Equals(_byteEncoding, other._byteEncoding);
 }
예제 #30
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 = NPOI.SS.Formula.Formula.Read(formulaLen, in1, nBytesRemaining);
        }
예제 #31
0
        public DVRecord(int validationType, int operator1, int errorStyle, bool emptyCellAllowed,
            bool suppressDropDownArrow, bool isExplicitList,
            bool showPromptBox, String promptTitle, String promptText,
            bool showErrorBox, String errorTitle, String errorText,
            Ptg[] formula1, Ptg[] formula2,
            CellRangeAddressList regions)
        {

            int flags = 0;
            flags = opt_data_type.SetValue(flags, validationType);
            flags = opt_condition_operator.SetValue(flags, operator1);
            flags = opt_error_style.SetValue(flags, errorStyle);
            flags = opt_empty_cell_allowed.SetBoolean(flags, emptyCellAllowed);
            flags = opt_suppress_dropdown_arrow.SetBoolean(flags, suppressDropDownArrow);
            flags = opt_string_list_formula.SetBoolean(flags, isExplicitList);
            flags = opt_show_prompt_on_cell_selected.SetBoolean(flags, showPromptBox);
            flags = opt_show_error_on_invalid_value.SetBoolean(flags, showErrorBox);
            _option_flags = flags;
            _promptTitle = ResolveTitleText(promptTitle);
            _promptText = ResolveTitleText(promptText);
            _errorTitle = ResolveTitleText(errorTitle);
            _errorText = ResolveTitleText(errorText);
            _formula1 = NPOI.SS.Formula.Formula.Create(formula1);
            _formula2 = NPOI.SS.Formula.Formula.Create(formula2);
            _regions = regions;
        }
예제 #32
0
 /**
  * @param ptgs may be <c>null</c>
  * @return encoded size of the formula
  */
 private int GetFormulaSize(FR.Formula formula)
 {
     return(formula.EncodedTokenSize);
 }
예제 #33
0
        /**
         * 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);
        }
예제 #34
0
 public void SetParsedExpression(Ptg[] ptgs)
 {
     field_5_name_definition = Formula.Create(ptgs);
 }
예제 #35
0
파일: NameRecord.cs 프로젝트: ctddjyds/npoi
        /** Creates new NameRecord */
        public NameRecord()
        {
            field_13_name_definition = SSFormula.Formula.Create(Ptg.EMPTY_PTG_ARRAY);

            field_12_name_text = "";
            field_14_custom_menu_text = "";
            field_15_description_text = "";
            field_16_help_topic_text = "";
            field_17_status_bar_text = "";
        }
예제 #36
0
        /** Creates new CFRuleRecord */
        private CFRuleRecord(byte conditionType, ComparisonOperator comparisonOperation)
        {
            field_1_condition_type = conditionType;
            field_2_comparison_operator =(byte) comparisonOperation;

            // Set modification flags to 1: by default options are not modified
            field_5_options = modificationBits.SetValue(field_5_options, -1);
            // Set formatting block flags to 0 (no formatting blocks)
            field_5_options = fmtBlockBits.SetValue(field_5_options, 0);
            field_5_options = Undocumented.Clear(field_5_options);

            //TODO:: check what's this field used for
            field_6_not_used = unchecked((short)0x8002); // Excel seems to Write this value, but it doesn't seem to care what it Reads
            _fontFormatting = null;
            //field_8_align_text_break = 0;
            //field_9_align_text_rotation_angle = 0;
            //field_10_align_indentation = 0;
            //field_11_relative_indentation = 0;
            //field_12_not_used = 0;
            _borderFormatting = null;
            _patternFormatting = null;
            field_17_formula1 = FR.Formula.Create(Ptg.EMPTY_PTG_ARRAY);
            field_18_formula2 = FR.Formula.Create(Ptg.EMPTY_PTG_ARRAY);
        }
예제 #37
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 = NPOI.SS.Formula.Formula.Read(field_7_expression_len, in1,in1.Available());
        }
예제 #38
0
        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);
    }
예제 #39
0
 public bool IsSame(Formula other)
 {
     return(Arrays.Equals(_byteEncoding, other._byteEncoding));
 }