public void TestRecord() { POIFSFileSystem fs = new POIFSFileSystem( HSSFTestDataSamples.OpenSampleFileStream("WithFormattedGraphTitle.xls")); // Check we can Open the file via usermodel HSSFWorkbook hssf = new HSSFWorkbook(fs); // Now process it through eventusermodel, and // look out for the title records ChartTitleFormatRecordGrabber grabber = new ChartTitleFormatRecordGrabber(); Stream din = fs.CreateDocumentInputStream("Workbook"); HSSFRequest req = new HSSFRequest(); req.AddListenerForAllRecords(grabber); HSSFEventFactory factory = new HSSFEventFactory(); factory.ProcessEvents(req, din); din.Close(); // Should've found one Assert.AreEqual(1, grabber.chartTitleFormatRecords.Count); // And it should be of something interesting AlRunsRecord r = (AlRunsRecord)grabber.chartTitleFormatRecords[0]; Assert.AreEqual(3, r.GetFormatCount()); }
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)); }