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.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); }
/** * 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())); } }
/** * 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(); } }
/** * 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(); } }
public ArrayRecord(RecordInputStream in1) : base(in1) { _options = in1.ReadUShort(); _field3notUsed = in1.ReadInt(); int formulaTokenLen = in1.ReadUShort(); int totalFormulaLen = in1.Available(); _formula = Npoi.Core.SS.Formula.Formula.Read(formulaTokenLen, in1, totalFormulaLen); }
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); }
/// <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); } }
/** * 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(); }
/** * 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(); }
/** * 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."); } }
private short field_3_xf_index; // Biff 3+ protected OldCellRecord(RecordInputStream in1, bool isBiff2) { 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(); } }
/** * 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_option_flags = in1.ReadShort(); }
/** * 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--; } }
/** * 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(); } }
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); }
/** * 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 + ")"); } }
/** * 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; }
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 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; } }
/** * Constructs a RefreshAll record and Sets its fields appropriately. * @param in the RecordInputstream to Read the record from */ public RefreshAllRecord(RecordInputStream in1) : this(in1.ReadUShort()) { }
public TextObjectRecord(RecordInputStream in1) { field_1_options = in1.ReadUShort(); field_2_textOrientation = in1.ReadUShort(); field_3_reserved4 = in1.ReadUShort(); field_4_reserved5 = in1.ReadUShort(); field_5_reserved6 = in1.ReadUShort(); int field_6_textLength = in1.ReadUShort(); int field_7_formattingDataLength = in1.ReadUShort(); field_8_reserved7 = in1.ReadInt(); if (in1.Remaining > 0) { // Text Objects can have simple reference formulas // (This bit not mentioned in the MS document) if (in1.Remaining < 11) { throw new RecordFormatException("Not enough remaining data for a link formula"); } int formulaSize = in1.ReadUShort(); _unknownPreFormulaInt = in1.ReadInt(); Ptg[] ptgs = Ptg.ReadTokens(formulaSize, in1); if (ptgs.Length != 1) { throw new RecordFormatException("Read " + ptgs.Length + " tokens but expected exactly 1"); } _linkRefPtg = (OperandPtg)ptgs[0]; if (in1.Remaining > 0) { _unknownPostFormulaByte = (byte)in1.ReadByte(); } else { _unknownPostFormulaByte = null; } } else { _linkRefPtg = null; } if (in1.Remaining > 0) { throw new RecordFormatException("Unused " + in1.Remaining + " bytes at end of record"); } String text; if (field_6_textLength > 0) { text = ReadRawString(in1, field_6_textLength); } else { text = ""; } _text = new HSSFRichTextString(text); if (field_7_formattingDataLength > 0) { ProcessFontRuns(in1, _text, field_7_formattingDataLength); } }
/** * 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(); }
/** * Constructs a BlankRecord and Sets its fields appropriately * @param in the RecordInputstream to Read the record from */ public BlankRecord(RecordInputStream in1) { field_1_row = in1.ReadUShort(); field_2_col = in1.ReadShort(); field_3_xf = in1.ReadShort(); }
/** * Read hyperlink from input stream * * @param in the stream to Read from */ public HyperlinkRecord(RecordInputStream in1) { _range = new CellRangeAddress(in1); // 16-byte GUID _guid = new GUID(in1); /* * streamVersion (4 bytes): An unsigned integer that specifies the version number * of the serialization implementation used to save this structure. This value MUST equal 2. */ int streamVersion = in1.ReadInt(); if (streamVersion != 0x00000002) { throw new RecordFormatException("Stream Version must be 0x2 but found " + streamVersion); } _linkOpts = in1.ReadInt(); if ((_linkOpts & HLINK_LABEL) != 0) { int label_len = in1.ReadInt(); _label = in1.ReadUnicodeLEString(label_len); } if ((_linkOpts & HLINK_TARGET_FRAME) != 0) { int len = in1.ReadInt(); _targetFrame = in1.ReadUnicodeLEString(len); } if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) != 0) { _moniker = null; int nChars = in1.ReadInt(); _address = in1.ReadUnicodeLEString(nChars); } if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) == 0) { _moniker = new GUID(in1); if (URL_MONIKER.Equals(_moniker)) { int length = in1.ReadInt(); /* * The value of <code>length<code> be either the byte size of the url field * (including the terminating NULL character) or the byte size of the url field plus 24. * If the value of this field is set to the byte size of the url field, * then the tail bytes fields are not present. */ int remaining = in1.Remaining; if (length == remaining) { int nChars = length / 2; _address = in1.ReadUnicodeLEString(nChars); } else { int nChars = (length - TAIL_SIZE) / 2; _address = in1.ReadUnicodeLEString(nChars); /* * TODO: make sense of the remaining bytes * According to the spec they consist of: * 1. 16-byte GUID: This field MUST equal * {0xF4815879, 0x1D3B, 0x487F, 0xAF, 0x2C, 0x82, 0x5D, 0xC4, 0x85, 0x27, 0x63} * 2. Serial version, this field MUST equal 0 if present. * 3. URI Flags */ _uninterpretedTail = ReadTail(URL_uninterpretedTail, in1); } } else if (FILE_MONIKER.Equals(_moniker)) { _fileOpts = in1.ReadShort(); int len = in1.ReadInt(); _shortFilename = StringUtil.ReadCompressedUnicode(in1, len); _uninterpretedTail = ReadTail(FILE_uninterpretedTail, in1); int size = in1.ReadInt(); if (size > 0) { int charDataSize = in1.ReadInt(); //From the spec: An optional unsigned integer that MUST be 3 if present // but some files has 4 int usKeyValue = in1.ReadUShort(); _address = StringUtil.ReadUnicodeLE(in1, charDataSize / 2); } else { _address = null; } } else if (STD_MONIKER.Equals(_moniker)) { _fileOpts = in1.ReadShort(); int len = in1.ReadInt(); byte[] path_bytes = new byte[len]; in1.ReadFully(path_bytes); _address = Encoding.UTF8.GetString(path_bytes); } } if ((_linkOpts & HLINK_PLACE) != 0) { int len = in1.ReadInt(); _textMark = in1.ReadUnicodeLEString(len); } if (in1.Remaining > 0) { Console.WriteLine(HexDump.ToHex(in1.ReadRemainder())); } }
/** * Constructs a WindowProtect record and Sets its fields appropriately. * @param in the RecordInputstream to Read the record from */ public WindowProtectRecord(RecordInputStream in1) : this(in1.ReadUShort()) { }
protected CellRecord(RecordInputStream in1) { _rowIndex = in1.ReadUShort(); _columnIndex = in1.ReadUShort(); _formatIndex = in1.ReadUShort(); }
/** * Constructs a UseSelFS record and Sets its fields appropriately. * @param in the RecordInputstream to Read the record from */ public UseSelFSRecord(RecordInputStream in1) : this(in1.ReadUShort()) { }
/** * Constructs a RECALCID record and Sets its fields appropriately. * @param in the RecordInputstream to Read the record from */ public RecalcIdRecord(RecordInputStream in1) { in1.ReadUShort(); // field 'rt' should have value 0x01C1, but Excel doesn't care during reading _reserved0 = in1.ReadUShort(); _engineId = in1.ReadInt(); }
public Break(RecordInputStream in1) { main = in1.ReadUShort() - 1; subFrom = in1.ReadUShort(); subTo = in1.ReadUShort(); }