Example #1
0
 public PtgInt(ushort val, PtgDataType dt = PtgDataType.REFERENCE) : base(PtgNumber.PtgInt, dt)
 {
     this.Data    = val.ToString();
     this.type    = PtgType.Operand;
     this.popSize = 1;
     this.Length  = 3;
 }
Example #2
0
 public PtgFunc(FtabValues fTab, PtgDataType dt = PtgDataType.REFERENCE, bool setHighBit = false) : base(PtgNumber.PtgFunc, dt, setHighBit)
 {
     this.Data    = "";
     this.Length  = 3;
     this.popSize = 1;
     this.tab     = Convert.ToUInt16(fTab);
     this.type    = PtgType.Operator;
 }
Example #3
0
        public PtgNum(double number, PtgDataType dt = PtgDataType.REFERENCE) : base(PtgNumber.PtgNum, dt)
        {
            this.Length  = 9;
            this.type    = PtgType.Operand;
            this.popSize = 1;

            this.Data = Convert.ToString(number, CultureInfo.GetCultureInfo("en-US"));
        }
Example #4
0
        public PtgRef(int rw, int col, bool rwRelative, bool colRelative, PtgDataType dt = PtgDataType.REFERENCE) : base(PtgNumber.PtgRef, dt)
        {
            this.type    = PtgType.Operand;
            this.popSize = 1;
            this.Length  = 5;

            this.rw          = (ushort)rw;
            this.col         = (ushort)col;
            this.colRelative = colRelative;
            this.rwRelative  = rwRelative;
        }
Example #5
0
        public PtgFuncVar(FtabValues ftab, int cparams, PtgDataType dt = PtgDataType.REFERENCE) : base(PtgNumber.PtgFuncVar, dt)
        {
            this.Length = 4;
            this.Data   = "";
            this.type   = PtgType.Operator;

            this.cparams  = (byte)cparams;
            this.tab      = (ushort)ftab;
            this.fCelFunc = false;
            this.popSize  = (uint)this.cparams;
        }
Example #6
0
        public PtgRef3d(int rw, int col, int ixti, bool rwRelative = false,
                        bool colRelative = false, PtgDataType dt = PtgDataType.REFERENCE) : base(PtgNumber.PtgRef3d,
                                                                                                 dt)
        {
            this.Length  = 7;
            this.type    = PtgType.Operand;
            this.popSize = 1;

            this.ixti = Convert.ToUInt16(ixti);
            this.rw   = Convert.ToUInt16(rw);
            this.col  = Convert.ToUInt16(col);

            this.rwRelative  = rwRelative;
            this.colRelative = colRelative;
        }
Example #7
0
        public PtgStr(string str, bool isUnicode = false, PtgDataType dt = PtgDataType.VALUE) : base(PtgNumber.PtgStr, dt)
        {
            this.type      = PtgType.Operand;
            this.popSize   = 1;
            this.Data      = ExcelHelperClass.EscapeFormulaString(str);
            this.isUnicode = isUnicode;

            if (isUnicode == false)
            {
                this.Length = (uint)(3 + str.Length);   // length = 1 byte Ptgtype + 1byte cch + 1byte highbyte
            }
            else
            {
                this.Length = (uint)(3 + str.Length * 2);
            }
        }
Example #8
0
        public AbstractPtg(PtgNumber ptgid, PtgDataType dt = PtgDataType.REFERENCE)
        {
            if ((int)ptgid > 0x5D)
            {
                this.dataType = PtgDataType.ARRAY;
                this._id      = ptgid - 0x40;
            }

            else if ((int)ptgid > 0x3D)
            {
                this.dataType = PtgDataType.VALUE;
                this._id      = ptgid - 0x20;
            }
            else
            {
                this.dataType = dt;
                this._id      = ptgid;
            }

            this.data = "";
        }
Example #9
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="reader">Streamreader</param>
        /// <param name="id">Ptg Id</param>
        /// <param name="length">The recordlength</param>
        public AbstractPtg(IStreamReader reader, PtgNumber ptgid)
        {
            this._reader = reader;
            this._offset = this._reader.BaseStream.Position;

            if ((int)ptgid > 0x5D)
            {
                this.dataType = PtgDataType.ARRAY;
                this._id      = ptgid - 0x40;
            }

            else if ((int)ptgid > 0x3D)
            {
                this.dataType = PtgDataType.VALUE;
                this._id      = ptgid - 0x20;
            }
            else
            {
                this.dataType = PtgDataType.REFERENCE;
                this._id      = ptgid;
            }

            this.data = "";
        }
Example #10
0
        public AbstractPtg(PtgNumber ptgid, PtgDataType dt = PtgDataType.REFERENCE, bool fPtgNumberHighBit = false)
        {
            if ((int)ptgid > 0x5D)
            {
                this.dataType = PtgDataType.ARRAY;
                this._id      = ptgid - 0x40;
            }

            else if ((int)ptgid > 0x3D)
            {
                this.dataType = PtgDataType.VALUE;
                this._id      = ptgid - 0x20;
            }
            else
            {
                this.dataType = dt;
                this._id      = ptgid;
            }

            //Looks like whenever this is true the formula is corrupted, probably worth ignoring
            this.fPtgNumberHighBit = fPtgNumberHighBit;

            this.data = "";
        }