Exemplo n.º 1
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.Core.SS.Formula.Formula.Create(formula1);
            _formula2     = Npoi.Core.SS.Formula.Formula.Create(formula2);
            _regions      = regions;
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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.Core.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.Core.SS.Formula.Formula.Read(field_size_sec_formula, in1);

            //read cell range address list with all affected ranges
            _regions = new CellRangeAddressList(in1);
        }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
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.Core.SS.Formula.Formula.Read(field_6_expression_len, in1, nAvailableBytes);
        }
Exemplo n.º 6
0
        /** 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 = "";
        }
Exemplo n.º 7
0
        /**
         * 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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
 private SharedFormulaRecord(CellRangeAddress8Bit range) :
     base(range)
 {
     field_7_parsed_expr = Formula.Create(Ptg.EMPTY_PTG_ARRAY);
 }
Exemplo n.º 10
0
 /**
  * @param ptgs may be <c>null</c>
  * @return encoded size of the formula
  */
 private int GetFormulaSize(FR.Formula formula)
 {
     return(formula.EncodedTokenSize);
 }