Ejemplo n.º 1
0
        internal void SaveToStream(IDataStream DataStream, TSaveData SaveData, byte PanePos)
        {
            if (SelectedCells == null || SelectedCells.Length == 0)
            {
                return;
            }

            if ((SaveData.ExcludedRecords & TExcludedRecords.CellSelection) != 0)
            {
                return;                                                                   //Note that this will invalidate the size, but it doesnt matter as this is not saved for real use. We could write blanks here if we wanted to keep the offsets right.
            }
            byte[] ppos = new byte[1]; ppos[0] = PanePos;

            int CurrentPos = 0;

            do
            {
                int    OldPos     = CurrentPos;
                UInt16 RecordSize = ActualRecordSize(ref CurrentPos);
                DataStream.WriteHeader((UInt16)xlr.SELECTION, (UInt16)(RecordSize - XlsConsts.SizeOfTRecordHeader));
                DataStream.Write(ppos, ppos.Length);

                DataStream.WriteRow(ActiveRow);
                DataStream.WriteCol(ActiveCol);

                DataStream.Write16((UInt16)ActiveSel);

                int len = CurrentPos - OldPos;
                DataStream.Write16((UInt16)len);

                unchecked
                {
                    for (int i = 0; i < len; i++)
                    {
                        DataStream.WriteRow(SelectedCells[i].Top);
                        DataStream.WriteRow(SelectedCells[i].Bottom);
                        DataStream.WriteColByte(SelectedCells[i].Left);
                        DataStream.WriteColByte(SelectedCells[i].Right);
                    }
                }
            }while (CurrentPos < SelectedCells.Length);
        }