Beispiel #1
0
        private static List <Record> ReadRecords(Stream stream, out MSODRAWINGGROUP drawingGroup)
        {
            List <Record> records = new List <Record>();

            drawingGroup = null;
            Record record = Record.Read(stream);

            record.Decode();
            Record last_record = record;

            if (record is BOF && ((BOF)record).StreamType == StreamType.WorkbookGlobals)
            {
                while (record.Type != RecordType.EOF)
                {
                    if (record.Type == RecordType.CONTINUE)
                    {
                        last_record.ContinuedRecords.Add(record);
                    }
                    else
                    {
                        switch (record.Type)
                        {
                        case RecordType.MSODRAWINGGROUP:
                            if (drawingGroup == null)
                            {
                                drawingGroup = record as MSODRAWINGGROUP;
                                records.Add(record);
                            }
                            else
                            {
                                drawingGroup.ContinuedRecords.Add(record);
                            }
                            break;

                        default:
                            records.Add(record);
                            break;
                        }
                        last_record = record;
                    }
                    record = Record.Read(stream);
                }
                records.Add(record);
            }
            else
            {
                throw new Exception("Invalid Workbook.");
            }
            return(records);
        }
        private static List <Record> ReadRecords(Stream stream, out MSODRAWINGGROUP drawingGroup)
        {
            List <Record> list = new List <Record>();

            drawingGroup = null;
            Record record = Record.Read(stream);

            record.Decode();
            Record record2 = record;

            if (record is BOF && ((BOF)record).StreamType == 5)
            {
                while (record.Type != 10)
                {
                    if (record.Type == 60)
                    {
                        record2.ContinuedRecords.Add(record);
                    }
                    else
                    {
                        ushort type = record.Type;
                        if (type != 235)
                        {
                            list.Add(record);
                        }
                        else
                        {
                            if (drawingGroup == null)
                            {
                                drawingGroup = (record as MSODRAWINGGROUP);
                                list.Add(record);
                            }
                            else
                            {
                                drawingGroup.ContinuedRecords.Add(record);
                            }
                        }
                        record2 = record;
                    }
                    record = Record.Read(stream);
                }
                list.Add(record);
                return(list);
            }
            throw new Exception("Invalid Workbook.");
        }
Beispiel #3
0
        private static List <Record> ReadRecords(Stream stream, out MSODRAWING drawingRecord)
        {
            List <Record> records = new List <Record>();

            drawingRecord = null;
            Record record              = Record.Read(stream);
            Record last_record         = record;
            Record last_formula_record = null;

            last_record.Decode();
            if (record is BOF && ((BOF)record).StreamType == StreamType.Worksheet)
            {
                while (record.Type != RecordType.EOF)
                {
                    if (record.Type == RecordType.CONTINUE)
                    {
                        last_record.ContinuedRecords.Add(record);
                    }
                    else
                    {
                        switch (record.Type)
                        {
                        case RecordType.STRING:
                            // jetcat_au: use last_formula_record instead of last_record
                            if (last_formula_record is FORMULA)
                            {
                                record.Decode();
                                (last_formula_record as FORMULA).StringRecord = record as STRING;
                            }
                            break;

                        case RecordType.MSODRAWING:
                            if (drawingRecord == null)
                            {
                                drawingRecord = record as MSODRAWING;
                                records.Add(record);
                            }
                            else
                            {
                                drawingRecord.ContinuedRecords.Add(record);
                            }
                            break;

                        default:
                            records.Add(record);
                            break;
                        }
                        // jetcat_au: see 4.8 Array Formulas and Shared Formulas
                        if (record.Type == RecordType.FORMULA)
                        {
                            last_formula_record = record;
                        }
                        else if (record.Type != RecordType.SHRFMLA && record.Type != RecordType.ARRAY)
                        {
                            last_formula_record = null;
                        }
                        last_record = record;
                    }
                    record = Record.Read(stream);
                }
                records.Add(record);
            }
            return(records);
        }
        private static List <Record> ReadRecords(Stream stream, out MSODRAWING drawingRecord)
        {
            List <Record> list = new List <Record>();

            drawingRecord = null;
            Record record  = Record.Read(stream);
            Record record2 = record;
            Record record3 = null;

            record2.Decode();
            if (record is BOF && ((BOF)record).StreamType == 16)
            {
                while (record.Type != 10)
                {
                    if (record.Type == 60)
                    {
                        record2.ContinuedRecords.Add(record);
                    }
                    else
                    {
                        ushort type = record.Type;
                        if (type != 236)
                        {
                            if (type != 519)
                            {
                                list.Add(record);
                            }
                            else
                            {
                                if (record3 is FORMULA)
                                {
                                    record.Decode();
                                    (record3 as FORMULA).StringRecord = (record as STRING);
                                }
                            }
                        }
                        else
                        {
                            if (drawingRecord == null)
                            {
                                drawingRecord = (record as MSODRAWING);
                                list.Add(record);
                            }
                            else
                            {
                                drawingRecord.ContinuedRecords.Add(record);
                            }
                        }
                        if (record.Type == 6)
                        {
                            record3 = record;
                        }
                        else
                        {
                            if (record.Type != 1212 && record.Type != 545)
                            {
                                record3 = null;
                            }
                        }
                        record2 = record;
                    }
                    record = Record.Read(stream);
                }
                list.Add(record);
            }
            return(list);
        }