Пример #1
0
        internal static byte[] ConvertXlsRecordToBytes(XLSRecord record)
        {
            MemoryStream stream = new MemoryStream();
            BinaryWriter bw     = new BinaryWriter(stream);

            record.Write(bw);
            byte[] buffer = stream.ToArray();
            stream.Close();
            return(buffer);
        }
Пример #2
0
        private void SaveMsoDrawing(AbsXLSRecords records, MsoContainerRecord dgContainer)
        {
            XLSRecord         record;
            MsoDelayedRecords delayedRecords = new MsoDelayedRecords
            {
                Offset = 8
            };

            byte[] sourceArray = dgContainer.ConvertToBytes(delayedRecords);
            sourceArray[0] = 15;
            int sourceIndex = 0;

            if (delayedRecords.Lengths.Count > 0)
            {
                int num2  = 0;
                int count = delayedRecords.Lengths.Count;
                while (num2 < count)
                {
                    int       num4             = (int)delayedRecords.Lengths[num2];
                    ArrayList list             = (ArrayList)delayedRecords.DelayedRecords[num2];
                    int       length           = num4 - sourceIndex;
                    byte[]    destinationArray = new byte[length];
                    Array.Copy(sourceArray, sourceIndex, destinationArray, 0, length);
                    new OptimizedBuffer();
                    if (num4 > 8224)
                    {
                        MemoryStream input = new MemoryStream();
                        input.Write(BitConverter.GetBytes((ushort)length), 0, 2);
                        input.Write(destinationArray, 2, destinationArray.Length);
                        input.Position = 0L;
                        record         = new XLSRecord(60, destinationArray.Length + 2, new BinaryReader(input));
                        input.Close();
                    }
                    else
                    {
                        record = new MsoDrawingRecord();
                        (record as MsoDrawingRecord).Data = destinationArray;
                    }
                    sourceIndex = num4;
                    records.Add(record);
                    for (int i = 0; i < list.Count; i++)
                    {
                        XLSRecord record2 = (XLSRecord)list[i];
                        records.Add(record2);
                    }
                    num2++;
                }
            }
            else
            {
                record = new MsoDrawingRecord();
                (record as MsoDrawingRecord).Data = sourceArray;
                records.Add(record);
            }
        }
Пример #3
0
        private XLSRecord GenerateFormattingRunsContinueRecord(byte[] formattingRunsBytes)
        {
            MemoryStream input = new MemoryStream();

            input.Write(formattingRunsBytes, 0, formattingRunsBytes.Length);
            input.Position = 0L;
            BinaryReader br     = new BinaryReader(input);
            XLSRecord    record = new XLSRecord(60, formattingRunsBytes.Length, br);

            input.Close();
            return(record);
        }
Пример #4
0
        private XLSRecord GenerateTextContinueRecord()
        {
            MemoryStream input = new MemoryStream();

            input.Write(new byte[] { 1 }, 0, 1);
            byte[] bytes = Encoding.Unicode.GetBytes(this.text);
            input.Write(bytes, 0, bytes.Length);
            input.Position = 0L;
            BinaryReader br     = new BinaryReader(input);
            XLSRecord    record = new XLSRecord(60, (this.text.Length * 2) + 1, br);

            input.Close();
            return(record);
        }
Пример #5
0
        public void Add(XLSRecord record, int recordCode)
        {
            ArrayList list = (ArrayList)this.typeGroupedRecords[recordCode];

            if (list != null)
            {
                list.Add(record);
            }
            else
            {
                list = new ArrayList();
                list.Add(record);
                this.typeGroupedRecords[recordCode] = (list);
            }
        }
Пример #6
0
 public void Add(XLSRecord subRecord)
 {
     this.items.Add(subRecord);
 }
Пример #7
0
 public void Add(XLSRecord record)
 {
     this.Add(record, record.RecordCode);
 }