public RefU(IStreamReader reader) { this.rwFirst = reader.ReadUInt16(); this.rwLast = reader.ReadUInt16(); this.colFirst = reader.ReadByte(); this.colLast = reader.ReadByte(); }
public ShtProps(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream ushort flags = reader.ReadUInt16(); this.fManSerAlloc = Utils.BitmaskToBool(flags, 0x1); this.fPlotVisOnly = Utils.BitmaskToBool(flags, 0x2); this.fNotSizeWith = Utils.BitmaskToBool(flags, 0x4); this.fManPlotArea = Utils.BitmaskToBool(flags, 0x8); this.fAlwaysAutoPlotArea = Utils.BitmaskToBool(flags, 0x10); this.mdBlank = (EmptyCellPlotMode)reader.ReadByte(); if (length > 3) { // skip the last optional byte reader.ReadByte(); } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
/// <summary> /// extracts the boundsheetdata from the biffrecord /// </summary> /// <param name="reader">IStreamReader </param> /// <param name="id">Type of the record </param> /// <param name="length">Length of the record</param> public BoundSheet8(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); this.lbPlyPos = this.Reader.ReadUInt32(); byte flags = reader.ReadByte(); Flags = flags; // Bitmask is 0003h -> first two bits, but we can hide our hidden status by flipping reserved bits this.hsState = (HiddenState)Utils.BitmaskToByte(flags, 0x00FF); this.dt = (SheetType)reader.ReadByte(); this.stName = new ShortXLUnicodeString(reader); if (this.Offset + this.Length != this.Reader.BaseStream.Position) { Console.WriteLine("BoundSheet8 Record is malformed - document probably has a password"); throw new Exception("BoundSheet8 Record is malformed - document probably has a password"); } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public FrtFontList(IStreamReader reader, GraphRecordNumber id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.frtHeaderOld = new FrtHeaderOld(reader); this.verExcel = reader.ReadByte(); // skip reserved byte reader.ReadByte(); this.cFont = reader.ReadUInt16(); if (this.cFont > 0) { this.rgFontInfo = new FontInfo[this.cFont]; for (int i = 0; i < this.cFont; i++) { this.rgFontInfo[i] = new FontInfo(reader); } } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public ShrFmla(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); this.rwFirst = reader.ReadUInt16(); this.rwLast = reader.ReadUInt16(); this.colFirst = (UInt16)reader.ReadByte(); this.colLast = (UInt16)reader.ReadByte(); // read two unnessesary bytes reader.ReadUInt16(); this.cce = reader.ReadUInt16(); this.ptgStack = new Stack <AbstractPtg>(); // reader.ReadBytes(this.cce); long oldStreamPosition = this.Reader.BaseStream.Position; try { this.ptgStack = ExcelHelperClass.getFormulaStack(this.Reader, this.cce); } catch (Exception ex) { this.Reader.BaseStream.Seek(oldStreamPosition, System.IO.SeekOrigin.Begin); this.Reader.BaseStream.Seek(this.cce, System.IO.SeekOrigin.Current); TraceLogger.Error(ex.StackTrace); } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Tick(IStreamReader reader, GraphRecordNumber id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.tktMajor = (MarkLocation)reader.ReadByte(); this.tktMinor = (MarkLocation)reader.ReadByte(); this.tlt = (MarkLabelLocation)reader.ReadByte(); this.wBkgMode = (BackgroundMode)reader.ReadByte(); this.rgb = new RGBColor(reader.ReadInt32(), RGBColor.ByteOrder.RedFirst); reader.ReadBytes(16); // rerserved ushort flags = reader.ReadUInt16(); this.fAutoCo = Utils.BitmaskToBool(flags, 0x1); this.fAutoMode = Utils.BitmaskToBool(flags, 0x2); this.rot = (TextRotation)Utils.BitmaskToInt(flags, 0x1C); this.fAutoRot = Utils.BitmaskToBool(flags, 0x10); this.iReadingOrder = (ReadingOrder)Utils.BitmaskToInt(flags, 0xC000); this.icv = reader.ReadUInt16(); this.trot = reader.ReadUInt16(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public EncryptionHeader(IStreamReader reader) { this.Flags = reader.ReadUInt32(); this.SizeExtra = reader.ReadUInt32(); this.AlgID = reader.ReadUInt32(); this.AlgIDHash = reader.ReadUInt32(); this.KeySize = reader.ReadUInt32(); this.ProviderType = reader.ReadUInt32(); this.Reserved1 = reader.ReadUInt32(); this.Reserved2 = reader.ReadUInt32(); List <byte> cspNameBytes = new List <byte>(); byte b1 = reader.ReadByte(); byte b2 = reader.ReadByte(); while (b1 != 0x00 || b2 != 0x00) { cspNameBytes.Add(b1); cspNameBytes.Add(b2); b1 = reader.ReadByte(); b2 = reader.ReadByte(); } this.CSPName = Encoding.Unicode.GetString(cspNameBytes.ToArray()); }
public Style(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.ixfe = reader.ReadUInt16(); this.fBuiltin = Utils.BitmaskToBool(this.ixfe, 0x8000); // only bit 11-0 are used // TODO: check if the filtering mask need to be applied or not this.ixfe = (ushort)(this.ixfe & 0x0FFF); if (this.fBuiltin) { this.istyBuiltIn = reader.ReadByte(); this.iLevel = reader.ReadByte(); } else { this.cch = reader.ReadUInt16(); int grbit = (int)reader.ReadByte(); this.rgch = ExcelHelperClass.getStringFromBiffRecord(reader, this.cch, grbit); } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Font(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.dyHeight = reader.ReadUInt16(); UInt16 flags = reader.ReadUInt16(); // 0x0001 is unused this.fItalic = Utils.BitmaskToBool(flags, 0x0002); // 0x0004 is unused this.fStrikeOut = Utils.BitmaskToBool(flags, 0x0008); this.fOutline = Utils.BitmaskToBool(flags, 0x0010); this.fShadow = Utils.BitmaskToBool(flags, 0x0020); this.fCondense = Utils.BitmaskToBool(flags, 0x0040); this.fExtend = Utils.BitmaskToBool(flags, 0x0080); this.icv = reader.ReadUInt16(); this.bls = (FontWeight)reader.ReadUInt16(); this.sss = (ScriptStyle)reader.ReadUInt16(); this.uls = (UnderlineStyle)reader.ReadByte(); this.bFamily = (FontFamily)reader.ReadByte(); this.bCharSet = reader.ReadByte(); // skip unused byte reader.ReadByte(); this.fontName = new ShortXLUnicodeString(reader); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public SerAuxTrend(IStreamReader reader, GraphRecordNumber id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.regt = (TrendlineType)reader.ReadByte(); this.ordUser = reader.ReadByte(); //read the nullable double value (ChartNumNillable) var b = reader.ReadBytes(4); if (b[2] == 0xFF && b[3] == 0xFF) { this.numIntercept = null; } else { this.numIntercept = System.BitConverter.ToDouble(b, 0); } this.fEquation = Utils.ByteToBool(reader.ReadByte()); this.fRSquared = Utils.ByteToBool(reader.ReadByte()); this.numForecast = reader.ReadDouble(); this.numBackcast = reader.ReadDouble(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
private bool SearchSequence(byte[] sequence) { while (_streamReader.CurrentBufferSize >= sequence.Length) { bool found = true; for (int x = 0; x < sequence.Length; x++) { byte value = _streamReader.ReadByte(); // add value to buffer if start sequence is already found if (_startSequenceFound) { _buffer.Add(value); } if (sequence[x] != value) { found = false; break; } } if (found) { return(true); } } return(false); }
public Legend(IStreamReader reader, GraphRecordNumber id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.x = reader.ReadUInt32(); this.y = reader.ReadUInt32(); this.dx = reader.ReadUInt32(); this.dy = reader.ReadUInt32(); reader.ReadByte(); // undefined this.wSpace = reader.ReadByte(); ushort flags = reader.ReadUInt16(); this.fAutoPosition = Utils.BitmaskToBool(flags, 0x1); //0x2 is reserved this.fAutoPosX = Utils.BitmaskToBool(flags, 0x4); this.fAutoPosY = Utils.BitmaskToBool(flags, 0x8); this.fVert = Utils.BitmaskToBool(flags, 0x10); this.fWasDataTable = Utils.BitmaskToBool(flags, 0x20); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public XmlTkBool(IStreamReader reader) { this.xtHeader = new XmlTkHeader(reader); this.dValue = (reader.ReadByte() > 0); //unused reader.ReadByte(); }
public XmlTkHeader(IStreamReader reader) { this.drType = reader.ReadByte(); //unused reader.ReadByte(); this.xmlTkTag = reader.ReadUInt16(); }
public Lbl(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated //Debug.Assert(this.Id == ID); ushort flags = reader.ReadUInt16(); this.fHidden = Utils.BitmaskToBool(flags, 0x0001); this.fFunc = Utils.BitmaskToBool(flags, 0x0002); this.fOB = Utils.BitmaskToBool(flags, 0x0004); this.fProc = Utils.BitmaskToBool(flags, 0x0008); this.fCalcExp = Utils.BitmaskToBool(flags, 0x0010); this.fBuiltin = Utils.BitmaskToBool(flags, 0x0020); this.fGrp = Utils.BitmaskToByte(flags, 0x0FC0); this.fReserved1 = Utils.BitmaskToBool(flags, 0x1000); this.fPublished = Utils.BitmaskToBool(flags, 0x2000); this.fWorkbookParam = Utils.BitmaskToBool(flags, 0x4000); this.fReserved2 = Utils.BitmaskToBool(flags, 0x8000); this.chKey = reader.ReadByte(); this.cch = reader.ReadByte(); this.cce = reader.ReadUInt16(); //read 2 reserved bytes this.fReserved3 = reader.ReadUInt16(); this.itab = reader.ReadUInt16(); // read 4 reserved bytes this.fReserved4 = reader.ReadUInt32(); if (this.cch > 0) { _name = new XLUnicodeStringNoCch(reader, this.cch); } else { _name = new XLUnicodeStringNoCch(); } long oldStreamPosition = this.Reader.BaseStream.Position; try { _rgce = ExcelHelperClass.getFormulaStack(this.Reader, this.cce); } catch (Exception ex) { this.Reader.BaseStream.Seek(oldStreamPosition, System.IO.SeekOrigin.Begin); this.Reader.BaseStream.Seek(this.cce, System.IO.SeekOrigin.Current); TraceLogger.Error("Formula parse error in intern name"); TraceLogger.Debug(ex.StackTrace); } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public PictFmlaEmbedInfo(IStreamReader reader) { this.ttb = reader.ReadByte(); this.cbClass = reader.ReadByte(); reader.ReadByte(); if (this.cbClass > 0) { this.strClass = new XLUnicodeStringNoCch(reader, this.cbClass); } }
public Chart3DBarShape(IStreamReader reader, GraphRecordNumber id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.riser = Utils.ByteToBool(reader.ReadByte()); this.taper = reader.ReadByte(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Chart3DBarShape(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.riser = (RiserType)reader.ReadByte(); this.taper = (TaperType)reader.ReadByte(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Mms(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream caitm = reader.ReadByte(); cditm = reader.ReadByte(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public BoolErr(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.bBoolErr = reader.ReadByte(); this.fError = reader.ReadByte() == 0x1; // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Selection(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.pnn = (PaneType)reader.ReadByte(); this.rwAct = reader.ReadUInt16(); this.colAct = reader.ReadUInt16(); this.irefAct = reader.ReadInt16(); this.cref = reader.ReadUInt16(); if (this.cref > 0) { this.rgref = new RefU[this.cref]; for (int i = 0; i < this.cref; i++) { this.rgref[i] = new RefU(reader); } } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public BRAI(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.braiId = (BraiId)reader.ReadByte(); this.rt = (DataSource)reader.ReadByte(); this.fUnlinkedIfmt = (Formatting)Utils.BitmaskToUInt16(reader.ReadUInt16(), 0x1); this.ifmt = reader.ReadUInt16(); this.formula = new ChartParsedFormula(reader); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public BRAI(IStreamReader reader, GraphRecordNumber id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.braiId = (BraiId)reader.ReadByte(); this.rt = reader.ReadByte(); this.fUnlinkedIfmt = (Formatting)Utils.BitmaskToUInt16(reader.ReadUInt16(), 0x1); this.ifmt = reader.ReadUInt16(); this.rowcol = reader.ReadUInt16(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
/// <summary> /// extracts the boundsheetdata from the biffrecord /// </summary> /// <param name="reader">IStreamReader </param> /// <param name="id">Type of the record </param> /// <param name="length">Length of the record</param> public BoundSheet8(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); this.lbPlyPos = this.Reader.ReadUInt32(); byte flags = reader.ReadByte(); Flags = flags; // Bitmask is 0003h -> first two bits, but we can hide our hidden status by flipping reserved bits this.hsState = (HiddenState)Utils.BitmaskToByte(flags, 0x00FF); this.dt = (SheetType)reader.ReadByte(); var oldStreamPosition = this.Reader.BaseStream.Position; var cch = reader.ReadByte(); var fHighByte = Utils.BitmaskToBool(reader.ReadByte(), 0x0001); this.Reader.BaseStream.Seek(oldStreamPosition, System.IO.SeekOrigin.Begin); if ((fHighByte && (this.Length - 8 != cch * 2)) || (!fHighByte && (this.Length - 8 != cch))) { //BoundSheet8 Record is Encrypted - just read the bytes, don't process them //don't grab lbPlyPos, dt, and hsState (6 bytes), but grab everything else this.RawSheetNameBytes = reader.ReadBytes((int)(this.Length - 6)); return; } else { this.stName = new ShortXLUnicodeString(reader); } if (this.Offset + this.Length != this.Reader.BaseStream.Position) { Console.WriteLine("BoundSheet8 Record is malformed - document probably has a password"); throw new Exception("BoundSheet8 Record is malformed - document probably has a password"); } // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public SerAuxErrBar(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.sertm = (ErrorBarDirection)reader.ReadByte(); this.ebsrc = (ErrorAmoutType)reader.ReadByte(); this.fTeeTop = Utils.ByteToBool(reader.ReadByte()); reader.ReadByte(); // reserved this.numValue = reader.ReadDouble(); reader.ReadBytes(2); //unused // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public Pane(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.x = reader.ReadUInt16(); this.y = reader.ReadUInt16(); this.rwTop = reader.ReadUInt16(); this.colLeft = reader.ReadUInt16(); this.pnnAcct = (PaneType)reader.ReadByte(); reader.ReadByte(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public ShortXLUnicodeString(IStreamReader reader) { this.cch = reader.ReadByte(); this.fHighByte = Utils.BitmaskToBool(reader.ReadByte(), 0x0001); if (this.fHighByte) { this.rgb = new byte[2 * this.cch]; } else { this.rgb = new byte[this.cch]; } this.rgb = reader.ReadBytes(this.rgb.Length); }
public BOF(IStreamReader reader, RecordType id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.version = reader.ReadUInt16(); if (this.version != 0x0600) { //throw new ParseException("Could not convert the file because it was created by an unsupported application (Excel 95 or older)."); } this.docType = (DocumentType)reader.ReadUInt16(); this.rupBuild = reader.ReadUInt16(); this.rupYear = reader.ReadUInt16(); uint flags = reader.ReadUInt32(); this.fWin = Utils.BitmaskToBool(flags, 0x0001); this.fRisc = Utils.BitmaskToBool(flags, 0x0002); this.fBeta = Utils.BitmaskToBool(flags, 0x0004); this.fWinAny = Utils.BitmaskToBool(flags, 0x0008); this.fMacAny = Utils.BitmaskToBool(flags, 0x0010); this.fBetaAny = Utils.BitmaskToBool(flags, 0x0020); this.fIgnore1 = Utils.BitmaskToBool(flags, 0x0040); this.fIgnore2 = Utils.BitmaskToBool(flags, 0x0080); this.fRiscAny = Utils.BitmaskToBool(flags, 0x0100); this.fOOM = Utils.BitmaskToBool(flags, 0x0200); this.fGlJmp = Utils.BitmaskToBool(flags, 0x0400); this.fIgnore3 = Utils.BitmaskToBool(flags, 0x0800); this.fIgnore4 = Utils.BitmaskToBool(flags, 0x1000); this.fFontLimit = Utils.BitmaskToBool(flags, 0x2000); this.verXLHigh = Utils.BitmaskToByte(flags, 0x0003C000); this.verLowestBiff = reader.ReadByte(); this.verLastXLSaved = Utils.BitmaskToByte(reader.ReadUInt16(), 0x00FF); // ignore remaing part of record reader.ReadByte(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public BiffString(IStreamReader reader) { cch = reader.ReadUInt16(); grbit = reader.ReadByte(); fHighByte = Utils.BitmaskToBool(grbit, 0x0001); fExtSt = Utils.BitmaskToBool(grbit, 0x0004); fRichSt = Utils.BitmaskToBool(grbit, 0x0008); }
public ShtProps(IStreamReader reader, GraphRecordNumber id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream ushort flags = reader.ReadUInt16(); this.fManSerAlloc = Utils.BitmaskToBool(flags, 0x1); // 0x2 and 0x4 are reserved this.fManPlotArea = Utils.BitmaskToBool(flags, 0x8); this.fAlwaysAutoPlotArea = Utils.BitmaskToBool(flags, 0x10); this.mdBlank = (EmptyCellPlotMode)reader.ReadByte(); reader.ReadByte(); // skip the last byte // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }