private static object DecodeRKInt(Bytes.Bits bits, bool div100) { object val = bits.Get(2, 30).ToInt32(); if (div100) { val = Convert.ToDouble(val) / 100.0; } return(val); }
private static double DecodeRKFloat(Bytes.Bits bits, bool div100) { Bytes.Bits floatBits = bits.Get(2, 30); floatBits.Prepend(false); //right-shift to full 8 bytes floatBits.Prepend(false); byte[] floatBytes = new byte[8]; floatBits.GetBytes().ByteArray.CopyTo(floatBytes, 4); byte[] double1Bytes = BitConverter.GetBytes((double)1); double val = BitConverter.ToDouble(floatBytes, 0); if (div100) { val /= 100.0; } return(val); }
private void DecodeRK(Bytes bytes) { Bytes.Bits bits = bytes.GetBits(); bool div100 = bits.Values[0]; bool isInt = bits.Values[1]; if (isInt) { Value = DecodeRKInt(bits, div100); _type = (Value is Int32) ? CellTypes.Integer : CellTypes.Float; } else { Value = DecodeRKFloat(bits, div100); _type = CellTypes.Float; } }
private void ReadXF_3(Bytes bytes) { Bytes.Bits bits = bytes.GetBits(); ushort parentStyleXfIndex = bits.Get(4, 12).ToUInt16(); if (parentStyleXfIndex == 4095) { //this is a Style XF -- do nothing } else { ReadStyleXfIndex = parentStyleXfIndex; //we'll assign the style xf index later using the xfIdxLookups collected by Workbook.ReadBytes() } ReadXF_TYPE_PROT(bits.Get(4)); }
private void ReadXF_TYPE_PROT(Bytes.Bits bits) { }