public ChartSheetAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_CHARTSHEET, container)
        {
            _bofRec = (BOFRecord)rs.GetNext();
            List <RecordBase> temp = new List <RecordBase>();

            while (rs.PeekNextClass() != typeof(EOFRecord))
            {
                Type a = rs.PeekNextClass();
                if (PageSettingsBlock.IsComponentRecord(rs.PeekNextChartSid()))
                {
                    if (_psBlock != null)
                    {
                        if (rs.PeekNextChartSid() == HeaderFooterRecord.sid)
                        {
                            // test samples: 45538_classic_Footer.xls, 45538_classic_Header.xls
                            _psBlock.AddLateHeaderFooter((HeaderFooterRecord)rs.GetNext());
                            continue;
                        }
                        throw new InvalidDataException(
                                  "Found more than one PageSettingsBlock in chart sub-stream");
                    }
                    _psBlock = new PageSettingsBlock(rs);
                    temp.Add(_psBlock);
                    continue;
                }
                if (rs.PeekNextChartSid() == ChartRecord.sid)
                {
                    chartFormats = new ChartFormatsAggregate(rs, this);
                    temp.Add(chartFormats);
                    continue;
                }
                if (rs.PeekNextChartSid() == DimensionsRecord.sid)
                {
                    seriesData = new SeriesDataAggregate(rs);
                    temp.Add(seriesData);
                    continue;
                }
                temp.Add(rs.GetNext());
            }
            _recs = temp;
            Record eof = rs.GetNext(); // no need to save EOF in field

            if (!(eof is EOFRecord))
            {
                throw new InvalidOperationException("Bad chart EOF");
            }
        }
示例#2
0
 public ChartSheetAggregate(RecordStream rs, ChartRecordAggregate container)
     : base(RuleName_CHARTSHEET, container)
 {
     _bofRec = (BOFRecord)rs.GetNext();
     List<RecordBase> temp = new List<RecordBase>();
     while (rs.PeekNextClass() != typeof(EOFRecord))
     {
         Type a = rs.PeekNextClass();
         if (PageSettingsBlock.IsComponentRecord(rs.PeekNextChartSid()))
         {
             if (_psBlock != null)
             {
                 if (rs.PeekNextChartSid() == HeaderFooterRecord.sid)
                 {
                     // test samples: 45538_classic_Footer.xls, 45538_classic_Header.xls
                     _psBlock.AddLateHeaderFooter((HeaderFooterRecord)rs.GetNext());
                     continue;
                 }
                 throw new InvalidDataException(
                         "Found more than one PageSettingsBlock in chart sub-stream");
             }
             _psBlock = new PageSettingsBlock(rs);
             temp.Add(_psBlock);
             continue;
         }
         if (rs.PeekNextChartSid() == ChartRecord.sid)
         {
             chartFormats = new ChartFormatsAggregate(rs, this);
             temp.Add(chartFormats);
             continue;
         }
         if (rs.PeekNextChartSid() == DimensionsRecord.sid)
         {
             seriesData = new SeriesDataAggregate(rs);
             temp.Add(seriesData);
             continue;
         }
         temp.Add(rs.GetNext());
     }
     _recs = temp;
     Record eof = rs.GetNext(); // no need to save EOF in field
     if (!(eof is EOFRecord))
     {
         throw new InvalidOperationException("Bad chart EOF");
     }
 }