public void LoadFromStream(Stream AStream, ushort AFileVersion) { int vOldSize = 10; ushort vSize = 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); // 字号 } // 字体 byte[] vBuffer = BitConverter.GetBytes(vSize); AStream.Read(vBuffer, 0, vBuffer.Length); vSize = BitConverter.ToUInt16(vBuffer, 0); if (vSize > 0) { vBuffer = new byte[vSize]; AStream.Read(vBuffer, 0, vBuffer.Length); FFamily = System.Text.Encoding.Default.GetString(vBuffer); } FFontStyles.Value = (byte)AStream.ReadByte(); // load FFontStyles HC.LoadColorFromStream(AStream, ref FColor); // load FColor HC.LoadColorFromStream(AStream, ref FBackColor); // load FBackColor }
public 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.AlignVert)vByte; // 垂直对齐方式 HC.LoadColorFromStream(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 { FCellData.Dispose(); FCellData = null; } }
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; } vBuffer = BitConverter.GetBytes(FFristIndent); AStream.Read(vBuffer, 0, vBuffer.Length); FFristIndent = BitConverter.ToInt32(vBuffer, 0); // vBuffer = BitConverter.GetBytes(FLeftIndent); AStream.Read(vBuffer, 0, vBuffer.Length); FLeftIndent = BitConverter.ToInt32(vBuffer, 0); // HC.LoadColorFromStream(AStream, ref FBackColor); // vByte = (byte)AStream.ReadByte(); FAlignHorz = (ParaAlignHorz)vByte; if (AFileVersion > 17) { vByte = (byte)AStream.ReadByte(); FAlignVert = (ParaAlignVert)vByte; } }