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; }
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); }
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); }
/** * 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); }
public ArrayRecord(NPOI.SS.Formula.Formula formula, CellRangeAddress8Bit range) : base(range) { _options = 0; //YK: Excel 2007 leaves this field unset _field3notUsed = 0; _formula = formula; }
/** * @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); }
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); }
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); }
/** * 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); }
/** 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 = ""; }
/** * 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()); }
/** * 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); }
/** 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); }
private SharedFormulaRecord(CellRangeAddress8Bit range): base(range) { field_7_parsed_expr = Formula.Create(Ptg.EMPTY_PTG_ARRAY); }
private SharedFormulaRecord(CellRangeAddress8Bit range) : base(range) { field_7_parsed_expr = Formula.Create(Ptg.EMPTY_PTG_ARRAY); }
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); }
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); }
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); } } }
public void SetParsedExpression(Ptg[] ptgs) { field_5_name_definition = Formula.Create(ptgs); }
/** * 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; }
public void SetParsedExpression(Ptg[] ptgs) { field_8_parsed_expr = NPOI.SS.Formula.Formula.Create(ptgs); }
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); }
//we'll just store/reSerialize /** Creates new FormulaRecord */ public FormulaRecord() { field_8_parsed_expr = NPOI.SS.Formula.Formula.Create(Ptg.EMPTY_PTG_ARRAY); }
public bool IsSame(Formula other) { return Arrays.Equals(_byteEncoding, other._byteEncoding); }
/** * @param ptgs may be <c>null</c> * @return encoded size of the formula */ private int GetFormulaSize(FR.Formula formula) { return(formula.EncodedTokenSize); }
/** 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); }
/** * 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()); }
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); }
public bool IsSame(Formula other) { return(Arrays.Equals(_byteEncoding, other._byteEncoding)); }