public ChartSubstreamRecordAggregate(RecordStream rs) { _bofRec = (BOFRecord)rs.GetNext(); List <RecordBase> temp = new List <RecordBase>(); while (rs.PeekNextClass() != typeof(EOFRecord)) { Type a = rs.PeekNextClass(); if (PageSettingsBlock.IsComponentRecord(rs.PeekNextSid())) { if (_psBlock != null) { if (rs.PeekNextSid() == 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; } 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"); } }
public ConditionalFormattingTable(RecordStream rs) { List <CFRecordsAggregate> temp = new List <CFRecordsAggregate>(); while (rs.PeekNextClass() == typeof(CFHeaderRecord) || rs.PeekNextClass() == typeof(CFHeader12Record)) { temp.Add(CFRecordsAggregate.CreateCFAggregate(rs)); } _cfHeaders = temp; }
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"); } }
public void TestAbnormalPivotTableRecords_bug46280() { int SXVIEW_SID = ViewDefinitionRecord.sid; Record[] inRecs = { new RowRecord(0), new NumberRecord(), // normally MSODRAWING(0x00EC) would come here before SXVIEW new UnknownRecord(SXVIEW_SID,System.Text.Encoding.UTF8.GetBytes("dummydata (SXVIEW: View DefInition)")), new WindowTwoRecord(), }; RecordStream rs = new RecordStream(inRecs.ToList(), 0); RowBlocksReader rbr = new RowBlocksReader(rs); if (rs.PeekNextClass() == typeof(WindowTwoRecord)) { // Should have stopped at the SXVIEW record throw new AssertionException("Identified bug 46280b"); } RecordStream rbStream = rbr.PlainRecordStream; Assert.AreEqual(inRecs[0], rbStream.GetNext()); Assert.AreEqual(inRecs[1], rbStream.GetNext()); Assert.IsFalse(rbStream.HasNext()); Assert.IsTrue(rs.HasNext()); Assert.AreEqual(inRecs[2], rs.GetNext()); Assert.AreEqual(inRecs[3], rs.GetNext()); }
public DataValidityTable(RecordStream rs) { _headerRec = (DVALRecord)rs.GetNext(); IList temp = new ArrayList(); while (rs.PeekNextClass() == typeof(DVRecord)) { temp.Add(rs.GetNext()); } _validationList = temp; }
/** * Reads zero or more consecutive {@link MergeCellsRecord}s * @param rs */ public void Read(RecordStream rs) { while (rs.PeekNextClass() == typeof(MergeCellsRecord)) { MergeCellsRecord mcr = (MergeCellsRecord)rs.GetNext(); int nRegions = mcr.NumAreas; for (int i = 0; i < nRegions; i++) { _mergedRegions.Add(mcr.GetAreaAt(i)); } } }
public void Construct(CellValueRecordInterface rec, RecordStream rs, SharedValueManager sfh) { if (rec is FormulaRecord) { FormulaRecord formulaRec = (FormulaRecord)rec; // read optional cached text value StringRecord cachedText = null; Type nextClass = rs.PeekNextClass(); if (nextClass == typeof(StringRecord)) { cachedText = (StringRecord)rs.GetNext(); } else { cachedText = null; } InsertCell(new FormulaRecordAggregate(formulaRec, cachedText, sfh)); } else { InsertCell(rec); } }
/// <summary> /// Initializes a new instance of the <see cref="ColumnInfoRecordsAggregate"/> class. /// </summary> /// <param name="rs">The rs.</param> public ColumnInfoRecordsAggregate(RecordStream rs) : this() { bool isInOrder = true; ColumnInfoRecord cirPrev = null; while (rs.PeekNextClass() == typeof(ColumnInfoRecord)) { ColumnInfoRecord cir = (ColumnInfoRecord)rs.GetNext(); records.Add(cir); if (cirPrev != null && CIRComparator.CompareColInfos(cirPrev, cir) > 0) { isInOrder = false; } cirPrev = cir; } if (records.Count < 1) { throw new InvalidOperationException("No column info records found"); } if (!isInOrder) { records.Sort(CIRComparator.instance); } }