Ejemplo n.º 1
0
        public void LoadFromStream(Stream aStream, ushort aFileVersion)
        {
            int vOldSize = 10;

            if (aFileVersion < 12)
            {
                byte[] vBuffer1 = BitConverter.GetBytes(vOldSize);
                aStream.Read(vBuffer1, 0, vBuffer1.Length);
                vOldSize = BitConverter.ToInt32(vBuffer1, 0);
                FSize    = (ushort)vOldSize;
            }
            else
            {
                byte[] vBuffer1 = BitConverter.GetBytes(FSize);
                aStream.Read(vBuffer1, 0, vBuffer1.Length);
                FSize = BitConverter.ToSingle(vBuffer1, 0);  // 字号
            }

            HC.HCLoadTextFromStream(aStream, ref FFamily, aFileVersion); // 字体

            FFontStyles.Value = (byte)aStream.ReadByte();                // load FFontStyles

            HC.HCLoadColorFromStream(aStream, ref FColor);               // load FColor
            HC.HCLoadColorFromStream(aStream, ref FBackColor);           // load FBackColor
        }
Ejemplo n.º 2
0
        public void LoadFromStream(Stream aStream, ushort aFileVersion)
        {
            byte[] vBuffer;
            if (aFileVersion < 15)
            {
                int vLineSpace = 0;
                vBuffer = BitConverter.GetBytes(vLineSpace);
                aStream.Read(vBuffer, 0, vBuffer.Length);
            }

            byte vByte = 0;

            if (aFileVersion > 16)
            {
                vByte          = (byte)aStream.ReadByte();
                FLineSpaceMode = (ParaLineSpaceMode)vByte;
            }

            if (aFileVersion < 22)
            {
                vBuffer = BitConverter.GetBytes(FFirstIndentPix);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FFirstIndentPix = BitConverter.ToInt32(vBuffer, 0);
                //
                vBuffer = BitConverter.GetBytes(FLeftIndentPix);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FLeftIndentPix = BitConverter.ToInt32(vBuffer, 0);
            }
            else
            {
                vBuffer = BitConverter.GetBytes(FFirstIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FFirstIndent    = BitConverter.ToSingle(vBuffer, 0);
                FFirstIndentPix = HCUnitConversion.MillimeterToPixX(FFirstIndent);
                //
                vBuffer = BitConverter.GetBytes(FLeftIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FLeftIndent    = BitConverter.ToSingle(vBuffer, 0);
                FLeftIndentPix = HCUnitConversion.MillimeterToPixX(FLeftIndent);
                //
                vBuffer = BitConverter.GetBytes(FRightIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FRightIndent    = BitConverter.ToSingle(vBuffer, 0);
                FRightIndentPix = HCUnitConversion.MillimeterToPixX(FRightIndent);
            }

            //
            HC.HCLoadColorFromStream(aStream, ref FBackColor);
            //
            vByte      = (byte)aStream.ReadByte();
            FAlignHorz = (ParaAlignHorz)vByte;

            if (aFileVersion > 17)
            {
                vByte      = (byte)aStream.ReadByte();
                FAlignVert = (ParaAlignVert)vByte;
            }
        }
Ejemplo n.º 3
0
        public virtual void LoadFromStream(Stream aStream, HCStyle aStyle, ushort aFileVersion)
        {
            byte[] vBuffer = BitConverter.GetBytes(FWidth);
            aStream.Read(vBuffer, 0, vBuffer.Length);
            FWidth = BitConverter.ToInt32(vBuffer, 0);

            vBuffer = BitConverter.GetBytes(FHeight);
            aStream.Read(vBuffer, 0, vBuffer.Length);
            FHeight = BitConverter.ToInt32(vBuffer, 0);

            vBuffer = BitConverter.GetBytes(FRowSpan);
            aStream.Read(vBuffer, 0, vBuffer.Length);
            FRowSpan = BitConverter.ToInt32(vBuffer, 0);

            vBuffer = BitConverter.GetBytes(FColSpan);
            aStream.Read(vBuffer, 0, vBuffer.Length);
            FColSpan = BitConverter.ToInt32(vBuffer, 0);

            if (aFileVersion > 11)
            {
                byte vByte = 0;
                vByte      = (byte)aStream.ReadByte();
                FAlignVert = (View.HCAlignVert)vByte;                    // 垂直对齐方式

                HC.HCLoadColorFromStream(aStream, ref FBackgroundColor); // 背景色
            }
            if (aFileVersion > 13)
            {
                FBorderSides.Value = (byte)aStream.ReadByte(); // load FBorderSides
            }

            bool vNullData = false;

            vBuffer = BitConverter.GetBytes(vNullData);
            aStream.Read(vBuffer, 0, vBuffer.Length);
            vNullData = BitConverter.ToBoolean(vBuffer, 0);
            if (!vNullData)
            {
                FCellData.LoadFromStream(aStream, aStyle, aFileVersion);
                FCellData.CellHeight = FHeight;
            }
            else
            if ((FRowSpan < 0) || (FColSpan < 0))  // 修正表格合并处理不准确造成的错误,容错打不开的情况
            {
                FCellData.Dispose();
                FCellData = null;
            }
        }
Ejemplo n.º 4
0
 public virtual void LoadFromStream(Stream aStream)
 {
     FStyle   = (HCShapeStyle)aStream.ReadByte();
     FVersion = (byte)aStream.ReadByte();
     HC.HCLoadColorFromStream(aStream, ref FColor);
 }