public override byte[] GetBytes() { using (BinaryWriter bw = new BinaryWriter(new MemoryStream())) { bw.Write(GetHeaderBytes()); bw.Write(Convert.ToUInt16(rw)); bw.Write(Convert.ToUInt16(col)); bw.Write(Convert.ToUInt16(ixfe)); bw.Write(val); bw.Write(Convert.ToUInt16(grbit)); bw.Write(Convert.ToUInt32(chn)); bw.Write(Convert.ToUInt16(cce)); if (!this.fShrFmla) { byte[] ptgBytes = PtgHelper.GetBytes(ptgStack); bw.Write(ptgBytes); } else { throw new NotImplementedException(); } return(bw.GetBytesWritten()); } }
public void SetRgce(Stack <AbstractPtg> rgce) { _rgce = rgce; byte[] rgceBytes = PtgHelper.GetBytes(rgce); cce = Convert.ToUInt16(rgceBytes.Length); _length = CalculateLength(); }
public CellParsedFormula(Stack <AbstractPtg> ptgStack) { rgce = PtgHelper.GetBytes(ptgStack); PtgStack = ptgStack; rgcb = new byte[] { }; cce = Convert.ToUInt16(rgce.Length); }
public override byte[] GetBytes() { using (MemoryStream stream = new MemoryStream()) { BinaryWriter bw = new BinaryWriter(stream); byte[] headerBytes = base.GetHeaderBytes(); bw.Write(headerBytes); uint flags = 0; flags = flags | Utils.BoolToBitmask(this.fHidden, 0x0001); flags = flags | Utils.BoolToBitmask(this.fFunc, 0x0002); flags = flags | Utils.BoolToBitmask(this.fOB, 0x0004); flags = flags | Utils.BoolToBitmask(this.fProc, 0x0008); flags = flags | Utils.BoolToBitmask(this.fCalcExp, 0x0010); flags = flags | Utils.BoolToBitmask(this.fBuiltin, 0x0020); flags = flags | Utils.ByteToBitmask(this.fGrp, 0x0FC0); flags = flags | Utils.BoolToBitmask(this.fReserved1, 0x1000); flags = flags | Utils.BoolToBitmask(this.fPublished, 0x2000); flags = flags | Utils.BoolToBitmask(this.fWorkbookParam, 0x4000); flags = flags | Utils.BoolToBitmask(this.fReserved2, 0x8000); bw.Write(Convert.ToUInt16(flags)); bw.Write(this.chKey); bw.Write(this.cch); bw.Write(Convert.ToUInt16(this.cce)); bw.Write(Convert.ToUInt16(this.fReserved3)); bw.Write(Convert.ToUInt16(this.itab)); bw.Write(Convert.ToUInt32(this.fReserved4)); if (RawLblBytes != null) { bw.Write(RawLblBytes); } else { bw.Write(this.Name.Bytes); if (this.rgce != null) { byte[] ptgBytes = PtgHelper.GetBytes(this.rgce); bw.Write(ptgBytes); } } return(bw.GetBytesWritten()); } }