public InternalChart(RecordStream rs) { _plsRecords = new List<PLSAggregate>(); records = new List<RecordBase>(128); if (rs.PeekNextSid() != BOFRecord.sid) { throw new Exception("BOF record expected"); } BOFRecord bof = (BOFRecord)rs.GetNext(); if (bof.Type != BOFRecord.TYPE_CHART) { throw new RuntimeException("Bad BOF record type"); } records.Add(bof); while (rs.HasNext()) { int recSid = rs.PeekNextSid(); Record.Record rec = rs.GetNext(); if (recSid == EOFRecord.sid) { records.Add(rec); break; } if (recSid == ChartRecord.sid) { continue; } if (recSid == ChartFRTInfoRecord.sid) { _chartFrtInfo = (ChartFRTInfoRecord)rec; } else if (recSid == HeaderRecord.sid) { header = (HeaderRecord)rec; } else if (recSid == FooterRecord.sid) { footer = (FooterRecord)rec; } else if (recSid == HCenterRecord.sid) { _hCenter = (HCenterRecord)rec; } else if (recSid == VCenterRecord.sid) { _vCenter = (VCenterRecord)rec; } else if (recSid == LeftMarginRecord.sid) { _leftMargin = (LeftMarginRecord)rec; } else if (recSid == RightMarginRecord.sid) { _rightMargin = (RightMarginRecord)rec; } else if (recSid == TopMarginRecord.sid) { _topMargin = (TopMarginRecord)rec; } else if (recSid == BottomMarginRecord.sid) { _bottomMargin = (BottomMarginRecord)rec; } else if (recSid == UnknownRecord.PLS_004D) // PLS { PLSAggregate pls = new PLSAggregate(rs); PLSAggregateVisitor rv = new PLSAggregateVisitor(records); pls.VisitContainedRecords(rv); _plsRecords.Add(pls); continue; } else if (recSid == PrintSetupRecord.sid) { printSetup = (PrintSetupRecord)rec; } else if (recSid == PrintSizeRecord.sid) { _printSize = (PrintSizeRecord)rec; } else if (recSid == HeaderFooterRecord.sid) { HeaderFooterRecord hf = (HeaderFooterRecord)rec; if (hf.IsCurrentSheet) _headerFooter = hf; else _sviewHeaderFooters.Add(hf); } else if (recSid == ProtectRecord.sid) { _protect = (ProtectRecord)rec; } records.Add(rec); } }
public CustomRecordVisitor1(CustomViewSettingsRecordAggregate cv, HeaderFooterRecord hf, List<HeaderFooterRecord> sviewHeaderFooter, Dictionary<String, HeaderFooterRecord> hfGuidMap) { this._cv = cv; this._hf = hf; this._sviewHeaderFooters = sviewHeaderFooter; _hfGuidMap = hfGuidMap; }
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 PrintSizeRecord.sid: 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; }
/// <summary> /// HEADERFOOTER is new in 2007. Some apps seem to have scattered this record long after /// the PageSettingsBlock where it belongs. /// </summary> /// <param name="rec"></param> public void AddLateHeaderFooter(HeaderFooterRecord rec) { if (_headerFooter != null) { throw new ArgumentNullException("This page settings block already has a header/footer record"); } if (rec.Sid != UnknownRecord.HEADER_FOOTER_089C) { throw new RecordFormatException("Unexpected header-footer record sid: 0x" + StringUtil.ToHexString(rec.Sid)); } _headerFooter = rec; }
public CustomRecordVisitor1(CustomViewSettingsRecordAggregate cv, HeaderFooterRecord hf, List<HeaderFooterRecord> sviewHeaderFooter) { this._cv = cv; this._hf = hf; this._sviewHeaderFooters = sviewHeaderFooter; }