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()); }
/** * @param rs record stream with all {@link SharedFormulaRecord} * {@link ArrayRecord}, {@link TableRecord} {@link MergeCellsRecord} Records removed */ public RowRecordsAggregate(RecordStream rs, SharedValueManager svm) : this(svm) { while (rs.HasNext()) { Record rec = rs.GetNext(); switch (rec.Sid) { case RowRecord.sid: InsertRow((RowRecord)rec); continue; case DConRefRecord.sid: AddUnknownRecord(rec); continue; case HyperlinkRecord.sid: _hyperlinkRecordRecords.Add((HyperlinkRecord)rec); continue; case DBCellRecord.sid: // end of 'Row Block'. Should only occur after cell records // ignore DBCELL records because POI generates them upon re-serialization continue; } if (rec is UnknownRecord) { // might need to keep track of where exactly these belong AddUnknownRecord((UnknownRecord)rec); while (rs.PeekNextSid() == ContinueRecord.sid) { AddUnknownRecord(rs.GetNext()); } continue; } if (rec is MulBlankRecord) { _valuesAgg.AddMultipleBlanks((MulBlankRecord)rec); continue; } if (!(rec is CellValueRecordInterface)) { //TODO: correct it, SeriesIndexRecord will appear in a separate chart sheet that contains a single chart // rule SERIESDATA = Dimensions 3(SIIndex *(Number / BoolErr / Blank / Label)) if (rec.Sid == SeriesIndexRecord.sid) { AddUnknownRecord(rec); continue; } throw new InvalidOperationException("Unexpected record type (" + rec.GetType().Name + ")"); } _valuesAgg.Construct((CellValueRecordInterface)rec, rs, svm); } }
private void ConstructValueRecord(IList records) { RowBlocksReader rbr = new RowBlocksReader(new RecordStream(records, 0)); SharedValueManager sfrh = rbr.SharedFormulaManager; RecordStream rs = rbr.PlainRecordStream; while (rs.HasNext()) { Record rec = rs.GetNext(); valueRecord.Construct((CellValueRecordInterface)rec, rs, sfrh); } }
/** * @param rs record stream with all {@link SharedFormulaRecord} * {@link ArrayRecord}, {@link TableRecord} {@link MergeCellsRecord} Records removed */ public RowRecordsAggregate(RecordStream rs, SharedValueManager svm) : this(svm) { while (rs.HasNext()) { Record rec = rs.GetNext(); switch (rec.Sid) { case RowRecord.sid: InsertRow((RowRecord)rec); continue; case DBCellRecord.sid: // end of 'Row Block'. Should only occur after cell records // ignore DBCELL records because POI generates them upon re-serialization continue; } if (rec is UnknownRecord) { // might need to keep track of where exactly these belong AddUnknownRecord((UnknownRecord)rec); while (rs.PeekNextSid() == ContinueRecord.sid) { AddUnknownRecord(rs.GetNext()); } continue; } if (rec is MulBlankRecord) { _valuesAgg.AddMultipleBlanks((MulBlankRecord)rec); continue; } if (!(rec is CellValueRecordInterface)) { throw new InvalidOperationException("Unexpected record type (" + rec.GetType().Name + ")"); } _valuesAgg.Construct((CellValueRecordInterface)rec, rs, svm); } }