Beispiel #1
0
        internal override void SaveToStream(IDataStream Workbook, TSaveData SaveData, int Row)
        {
            if (FText == null || FText.Length == 0)
            {
                return;
            }

            byte[] b = Encoding.Unicode.GetBytes(TrimmedText);

            Workbook.WriteHeader((UInt16)Id, (UInt16)(b.Length + 12));
            Workbook.Write16(0x0800); //record id
            Workbook.WriteRow(FirstRow);
            Workbook.WriteRow(LastRow);
            Workbook.WriteCol(FirstCol);
            Workbook.WriteCol(LastCol);

            Workbook.Write(b, b.Length);
            Workbook.Write16(0); //null terminated.
        }
Beispiel #2
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);
        }
Beispiel #3
0
        internal void SaveBiff8Data(IDataStream DataStream, bool SaveCoords, out int Len)
        {
            if (DataStream != null)
            {
                if (SaveCoords)
                {
                    DataStream.WriteRow(FirstRow);
                    DataStream.WriteRow(LastRow);
                    DataStream.WriteCol(FirstCol);
                    DataStream.WriteCol(LastCol);
                }

                //CLSID
                DataStream.Write32(0x79EAC9D0);
                DataStream.Write32(0x11CEBAF9);
                DataStream.Write32(0xAA00828C);
                DataStream.Write32(0x0BA94B00);

                //Starts HyperLink Object - MS-OSHARED
                DataStream.Write32(0x02);
                DataStream.Write32(OptionFlags);
            }

            Len = 32;

            WriteString(DataStream, FDescription, ref Len);
            WriteString(DataStream, FTargetFrame, ref Len);

            //This part of the structure is different depending on the type of link.
            switch (FLinkType)
            {
            case THyperLinkType.URL:
                if (DataStream != null)
                {
                    DataStream.Write(URLGUID, URLGUID.Length);
                }
                Len += URLGUID.Length;
                WriteString(DataStream, FText, ref Len, 1);
                break;

            case THyperLinkType.LocalFile:
                if (DataStream != null)
                {
                    DataStream.Write(FILEGUID, FILEGUID.Length);
                }
                Len += FILEGUID.Length;
                WriteLocalFile(DataStream, FText, ref Len);
                break;

            case THyperLinkType.UNC:
                //String Moniker
                WriteString(DataStream, FText, ref Len);
                break;

            case THyperLinkType.CurrentWorkbook:
                //CurrentWorkbook doesn't have monikers.
                break;

            default:
                XlsMessages.ThrowException(XlsErr.ErrInvalidHyperLinkType, (int)FLinkType);
                break;
            }


            WriteString(DataStream, FTextMark, ref Len);
        }