public AttachedLabelAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_ATTACHEDLABEL, container) { ChartSheetAggregate cs = GetContainer <ChartSheetAggregate>(ChartRecordAggregate.RuleName_CHARTSHEET); IsFirst = cs.AttachLabelCount == 0; cs.AttachLabelCount++; text = (TextRecord)rs.GetNext(); rs.GetNext();//BeginRecord pos = (PosRecord)rs.GetNext(); if (rs.PeekNextChartSid() == FontXRecord.sid) { fontX = (FontXRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == AlRunsRecord.sid) { alRuns = (AlRunsRecord)rs.GetNext(); } brai = (BRAIRecord)rs.GetNext(); if (rs.PeekNextChartSid() == SeriesTextRecord.sid) { seriesText = (SeriesTextRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == FrameRecord.sid) { frame = new FrameAggregate(rs, this); } if (rs.PeekNextChartSid() == ObjectLinkRecord.sid) { objectLink = (ObjectLinkRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == DataLabExtContentsRecord.sid) { dataLab = (DataLabExtContentsRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == CrtLayout12Record.sid) { crtLayout = (CrtLayout12Record)rs.GetNext(); } if (rs.PeekNextChartSid() == TextPropsStreamRecord.sid) { textProps = new TextPropsAggregate(rs, this); } if (rs.PeekNextChartSid() == CrtMlFrtRecord.sid) { crtMlFrt = new CrtMlFrtAggregate(rs, this); } Record r = rs.GetNext();//EndRecord Debug.Assert(r.GetType() == typeof(EndRecord)); }
public void TestStartBlock_EndBlock_Write() { HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("chartdemo.xls"); Record[] sheetRecs = RecordInspector.GetRecords(wb.GetSheetAt(0), 0); RecordStream rs = new RecordStream(Arrays.AsList(sheetRecs), 0); rs.FindChartSubStream(); int pos = rs.GetCountRead(); ChartSheetAggregate csAgg = new ChartSheetAggregate(rs, null); RecordInspector.RecordCollector rv = new RecordInspector.RecordCollector(); csAgg.VisitContainedRecords(rv); Record[] outRecs = rv.Records; for (int i = 0; i < outRecs.Length; i++) { Assert.AreEqual(sheetRecs[pos + i].GetType(), outRecs[i].GetType()); } }