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 CustomViewSettingsRecordAggregate(RecordStream rs) { _begin = rs.GetNext(); if (_begin.Sid != UserSViewBegin.sid) { throw new InvalidOperationException("Bad begin record"); } List <RecordBase> temp = new List <RecordBase>(); while (rs.PeekNextSid() != UserSViewEnd.sid) { if (PageSettingsBlock.IsComponentRecord(rs.PeekNextSid())) { if (_psBlock != null) { throw new InvalidOperationException( "Found more than one PageSettingsBlock in custom view Settings sub-stream"); } _psBlock = new PageSettingsBlock(rs); temp.Add(_psBlock); continue; } temp.Add(rs.GetNext()); } _recs = temp; _end = rs.GetNext(); // no need to save EOF in field if (_end.Sid != UserSViewEnd.sid) { throw new InvalidOperationException("Bad custom view Settings end record"); } }
private bool ReadARecord(RecordStream rs) { switch (rs.PeekNextSid()) { case ProtectRecord.sid: CheckNotPresent(_protectRecord); _protectRecord = rs.GetNext() as ProtectRecord; break; case ObjectProtectRecord.sid: CheckNotPresent(_objectProtectRecord); _objectProtectRecord = rs.GetNext() as ObjectProtectRecord; break; case ScenarioProtectRecord.sid: CheckNotPresent(_scenarioProtectRecord); _scenarioProtectRecord = rs.GetNext() as ScenarioProtectRecord; break; case PasswordRecord.sid: CheckNotPresent(_passwordRecord); _passwordRecord = rs.GetNext() as PasswordRecord; break; default: // all other record types are not part of the PageSettingsBlock return(false); } return(true); }
public PLSAggregate(RecordStream rs) { _pls = rs.GetNext(); if (rs.PeekNextSid() == ContinueRecord.sid) { List <ContinueRecord> temp = new List <ContinueRecord>(); while (rs.PeekNextSid() == ContinueRecord.sid) { temp.Add((ContinueRecord)rs.GetNext()); } _plsContinues = new ContinueRecord[temp.Count]; _plsContinues = temp.ToArray(); } else { _plsContinues = EMPTY_CONTINUE_RECORD_ARRAY; } }
/** * @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); } }
public CustomViewSettingsRecordAggregate(RecordStream rs) { _begin = rs.GetNext(); if (_begin.Sid != UserSViewBegin.sid) { throw new InvalidOperationException("Bad begin record"); } List <RecordBase> temp = new List <RecordBase>(); while (rs.PeekNextSid() != UserSViewEnd.sid) { 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 InvalidOperationException( "Found more than one PageSettingsBlock in chart sub-stream, had sid: " + rs.PeekNextSid()); } _psBlock = new PageSettingsBlock(rs); temp.Add(_psBlock); continue; } temp.Add(rs.GetNext()); } _recs = temp; _end = rs.GetNext(); // no need to save EOF in field if (_end.Sid != UserSViewEnd.sid) { throw new InvalidOperationException("Bad custom view Settings end record"); } }
/** * @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); } }
private bool ReadARecord(RecordStream rs) { switch (rs.PeekNextSid()) { case HorizontalPageBreakRecord.sid: CheckNotPresent(_rowBreaksRecord); _rowBreaksRecord = (PageBreakRecord)rs.GetNext(); break; case VerticalPageBreakRecord.sid: CheckNotPresent(_columnBreaksRecord); _columnBreaksRecord = (PageBreakRecord)rs.GetNext(); break; case HeaderRecord.sid: CheckNotPresent(header); header = (HeaderRecord)rs.GetNext(); break; case FooterRecord.sid: CheckNotPresent(footer); footer = (FooterRecord)rs.GetNext(); break; case HCenterRecord.sid: CheckNotPresent(_hCenter); _hCenter = (HCenterRecord)rs.GetNext(); break; case VCenterRecord.sid: CheckNotPresent(_vCenter); _vCenter = (VCenterRecord)rs.GetNext(); break; case LeftMarginRecord.sid: CheckNotPresent(_leftMargin); _leftMargin = (LeftMarginRecord)rs.GetNext(); break; case RightMarginRecord.sid: CheckNotPresent(_rightMargin); _rightMargin = (RightMarginRecord)rs.GetNext(); break; case TopMarginRecord.sid: CheckNotPresent(_topMargin); _topMargin = (TopMarginRecord)rs.GetNext(); break; case BottomMarginRecord.sid: CheckNotPresent(_bottomMargin); _bottomMargin = (BottomMarginRecord)rs.GetNext(); break; case UnknownRecord.PLS_004D: // PLS _plsRecords.Add(new PLSAggregate(rs)); break; case PrintSetupRecord.sid: CheckNotPresent(printSetup); printSetup = (PrintSetupRecord)rs.GetNext(); break; case UnknownRecord.BITMAP_00E9: // BITMAP CheckNotPresent(_bitmap); _bitmap = rs.GetNext(); break; case UnknownRecord.PRINTSIZE_0033: CheckNotPresent(_printSize); _printSize = rs.GetNext(); break; case HeaderFooterRecord.sid: HeaderFooterRecord hf = (HeaderFooterRecord)rs.GetNext(); if (hf.IsCurrentSheet) { _headerFooter = hf; } else { _sviewHeaderFooters.Add(hf); } break; default: // all other record types are not part of the PageSettingsBlock return(false); } return(true); }
private bool ReadARecord(RecordStream rs) { switch (rs.PeekNextSid()) { case HorizontalPageBreakRecord.sid: _rowBreaksRecord = (PageBreakRecord)rs.GetNext(); _rowRecords.Add(_rowBreaksRecord); break; case VerticalPageBreakRecord.sid: _columnBreaksRecord = (PageBreakRecord)rs.GetNext(); _rowRecords.Add(_columnBreaksRecord); break; case HeaderRecord.sid: header = (HeaderRecord)rs.GetNext(); _rowRecords.Add(header); break; case FooterRecord.sid: footer = (FooterRecord)rs.GetNext(); _rowRecords.Add(footer); break; case HCenterRecord.sid: _hCenter = (HCenterRecord)rs.GetNext(); _rowRecords.Add(_hCenter); break; case VCenterRecord.sid: _vCenter = (VCenterRecord)rs.GetNext(); _rowRecords.Add(_vCenter); break; case LeftMarginRecord.sid: _leftMargin = (LeftMarginRecord)rs.GetNext(); _rowRecords.Add(_leftMargin); break; case RightMarginRecord.sid: _rightMargin = (RightMarginRecord)rs.GetNext(); _rowRecords.Add(_rightMargin); break; case TopMarginRecord.sid: _topMargin = (TopMarginRecord)rs.GetNext(); _rowRecords.Add(_topMargin); break; case BottomMarginRecord.sid: _bottomMargin = (BottomMarginRecord)rs.GetNext(); _rowRecords.Add(_bottomMargin); break; case 0x004D: // PLS _pls = rs.GetNext(); _rowRecords.Add(_pls); break; case PrintSetupRecord.sid: printSetup = (PrintSetupRecord)rs.GetNext(); _rowRecords.Add(printSetup); break; case 0x00E9: // BITMAP _bitmap = rs.GetNext(); _rowRecords.Add(_bitmap); break; default: // all other record types are not part of the PageSettingsBlock return(false); } return(true); }