當前位置: 首頁>>代碼示例>>C#>>正文


C# RecordStream.PeekNextClass方法代碼示例

本文整理匯總了C#中NPOI.HSSF.Model.RecordStream.PeekNextClass方法的典型用法代碼示例。如果您正苦於以下問題:C# RecordStream.PeekNextClass方法的具體用法?C# RecordStream.PeekNextClass怎麽用?C# RecordStream.PeekNextClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NPOI.HSSF.Model.RecordStream的用法示例。


在下文中一共展示了RecordStream.PeekNextClass方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ChartSubstreamRecordAggregate

 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");
     }
 }
開發者ID:hanwangkun,項目名稱:npoi,代碼行數:33,代碼來源:ChartSubstreamRecordAggregate.cs

示例2: ReadExtSheetRecord

        // TODO make this class into a record aggregate

        private static ExternSheetRecord ReadExtSheetRecord(RecordStream rs)
        {
            List<ExternSheetRecord> temp = new List<ExternSheetRecord>(2);
            while (rs.PeekNextClass() == typeof(ExternSheetRecord))
            {
                temp.Add((ExternSheetRecord)rs.GetNext());
            }

            int nItems = temp.Count;
            if (nItems < 1)
            {
                throw new Exception("Expected an EXTERNSHEET record but got ("
                        + rs.PeekNextClass().Name + ")");
            }
            if (nItems == 1)
            {
                // this is the normal case. There should be just one ExternSheetRecord
                return temp[0];
            }
            // Some apps generate multiple ExternSheetRecords (see bug 45698).
            // It seems like the best thing to do might be to combine these into one
            ExternSheetRecord[] esrs = new ExternSheetRecord[nItems];
            esrs = temp.ToArray();
            return ExternSheetRecord.Combine(esrs);
        }
開發者ID:Reinakumiko,項目名稱:npoi,代碼行數:27,代碼來源:LinkTable.cs

示例3: TestAbnormalPivotTableRecords_bug46280

        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(Arrays.AsList(inRecs), 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());
        }
開發者ID:hanwangkun,項目名稱:npoi,代碼行數:25,代碼來源:TestRowBlocksReader.cs

示例4: ChartSheetAggregate

 public ChartSheetAggregate(RecordStream rs, ChartRecordAggregate container)
     : base(RuleName_CHARTSHEET, container)
 {
     _bofRec = (BOFRecord)rs.GetNext();
     List<RecordBase> temp = new List<RecordBase>();
     while (rs.PeekNextClass() != typeof(EOFRecord))
     {
         Type a = rs.PeekNextClass();
         if (PageSettingsBlock.IsComponentRecord(rs.PeekNextChartSid()))
         {
             if (_psBlock != null)
             {
                 if (rs.PeekNextChartSid() == 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;
         }
         if (rs.PeekNextChartSid() == ChartRecord.sid)
         {
             chartFormats = new ChartFormatsAggregate(rs, this);
             temp.Add(chartFormats);
             continue;
         }
         if (rs.PeekNextChartSid() == DimensionsRecord.sid)
         {
             seriesData = new SeriesDataAggregate(rs);
             temp.Add(seriesData);
             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");
     }
 }
開發者ID:xiepeixing,項目名稱:npoi,代碼行數:46,代碼來源:ChartSheetAggregate.cs

示例5: ConditionalFormattingTable

 public ConditionalFormattingTable(RecordStream rs)
 {
     IList temp = new ArrayList();
     while (rs.PeekNextClass() == typeof(CFHeaderRecord))
     {
         temp.Add(CFRecordsAggregate.CreateCFAggregate(rs));
     }
     _cfHeaders = temp;
 }
開發者ID:babywzazy,項目名稱:Server,代碼行數:9,代碼來源:ConditionalFormattingTable.cs

示例6: DataValidityTable

 public DataValidityTable(RecordStream rs)
 {
     _headerRec = (DVALRecord)rs.GetNext();
     IList temp = new ArrayList();
     while (rs.PeekNextClass() == typeof(DVRecord))
     {
         temp.Add(rs.GetNext());
     }
     _validationList = temp;
 }
開發者ID:ChiangHanLung,項目名稱:PIC_VDS,代碼行數:10,代碼來源:DataValidityTable.cs

示例7: Read

 /**
  * Reads zero or more consecutive {@link MergeCellsRecord}s
  * @param rs
  */
 public void Read(RecordStream rs)
 {
     IList temp = _mergedRegions;
     while (rs.PeekNextClass() == typeof(MergeCellsRecord))
     {
         MergeCellsRecord mcr = (MergeCellsRecord)rs.GetNext();
         int nRegions = mcr.NumAreas;
         for (int i = 0; i < nRegions; i++)
         {
             temp.Add(mcr.GetAreaAt(i));
         }
     }
 }
開發者ID:ChiangHanLung,項目名稱:PIC_VDS,代碼行數:17,代碼來源:MergedCellsTable.cs

示例8: ColumnInfoRecordsAggregate

 /// <summary>
 /// Initializes a new instance of the <see cref="ColumnInfoRecordsAggregate"/> class.
 /// </summary>
 /// <param name="rs">The rs.</param>
 public ColumnInfoRecordsAggregate(RecordStream rs): this()
 {
     bool isInOrder = true;
     ColumnInfoRecord cirPrev = null;
     while (rs.PeekNextClass() == typeof(ColumnInfoRecord))
     {
         ColumnInfoRecord cir = (ColumnInfoRecord)rs.GetNext();
         records.Add(cir);
         if (cirPrev != null && CIRComparator.CompareColInfos(cirPrev, cir) > 0)
         {
             isInOrder = false;
         }
         cirPrev = cir;
     }
     if (records.Count < 1)
     {
         throw new InvalidOperationException("No column info records found");
     }
     if (!isInOrder)
     {
         records.Sort(CIRComparator.instance);
     }
 }
開發者ID:xoposhiy,項目名稱:npoi,代碼行數:27,代碼來源:ColumnInfoRecordsAggregate.cs

示例9: Construct

 public void Construct(CellValueRecordInterface rec, RecordStream rs, SharedValueManager sfh)
 {
     if (rec is FormulaRecord)
     {
         FormulaRecord formulaRec = (FormulaRecord)rec;
         // read optional cached text value
         StringRecord cachedText=null;
         Type nextClass = rs.PeekNextClass();
         if (nextClass == typeof(StringRecord))
         {
             cachedText = (StringRecord)rs.GetNext();
         }
         else
         {
             cachedText = null;
         }
         InsertCell(new FormulaRecordAggregate(formulaRec, cachedText, sfh));
     }
     else
     {
         InsertCell(rec);
     }
 }
開發者ID:ctddjyds,項目名稱:npoi,代碼行數:23,代碼來源:ValueRecordsAggregate.cs

示例10: LinkTable

        private WorkbookRecordList _workbookRecordList; // TODO - would be nice to Remove this

        public LinkTable(List<Record> inputList, int startIndex, WorkbookRecordList workbookRecordList, Dictionary<String, NameCommentRecord> commentRecords)
        {

            _workbookRecordList = workbookRecordList;
            RecordStream rs = new RecordStream(inputList, startIndex);

            ArrayList temp = new ArrayList();
            while (rs.PeekNextClass() == typeof(SupBookRecord))
            {
                temp.Add(new ExternalBookBlock(rs));
            }

            //_externalBookBlocks = new ExternalBookBlock[temp.Count];
            _externalBookBlocks = (ExternalBookBlock[])temp.ToArray(typeof(ExternalBookBlock));
            temp.Clear();

            if (_externalBookBlocks.Length > 0)
            {
                // If any ExternalBookBlock present, there is always 1 of ExternSheetRecord
                if (rs.PeekNextClass() != typeof(ExternSheetRecord))
                {
                    // not quite - if written by google docs
                    _externSheetRecord = null;
                }
                else
                {
                    _externSheetRecord = ReadExtSheetRecord(rs);
                }
            }
            else
            {
                _externSheetRecord = null;
            }

            _definedNames = new List<NameRecord>();
            // collect zero or more DEFINEDNAMEs id=0x18
            while (true)
            {

                Type nextClass = rs.PeekNextClass();
                if (nextClass == typeof(NameRecord))
                {
                    NameRecord nr = (NameRecord)rs.GetNext();
                    _definedNames.Add(nr);
                }
                else if (nextClass == typeof(NameCommentRecord))
                {
                    NameCommentRecord ncr = (NameCommentRecord)rs.GetNext();
                    //commentRecords.Add(ncr.NameText, ncr);
                    commentRecords[ncr.NameText] = ncr;
                }
                else
                {
                    break;
                }
            }

            _recordCount = rs.GetCountRead();
            for (int i = startIndex; i < startIndex + _recordCount; i++)
            {
                _workbookRecordList.Records.Add(inputList[i]);
            }

        }
開發者ID:Reinakumiko,項目名稱:npoi,代碼行數:66,代碼來源:LinkTable.cs

示例11: ExternalBookBlock

            public ExternalBookBlock(RecordStream rs)
            {
                _externalBookRecord = (SupBookRecord)rs.GetNext();
                ArrayList temp = new ArrayList();
                while (rs.PeekNextClass() == typeof(ExternalNameRecord))
                {
                    temp.Add(rs.GetNext());
                }
                _externalNameRecords = (ExternalNameRecord[])temp.ToArray(typeof(ExternalNameRecord));

                temp.Clear();

                while (rs.PeekNextClass() == typeof(CRNCountRecord))
                {
                    temp.Add(new CRNBlock(rs));
                }
                _crnBlocks = (CRNBlock[])temp.ToArray(typeof(CRNBlock));
            }
開發者ID:Reinakumiko,項目名稱:npoi,代碼行數:18,代碼來源:LinkTable.cs

示例12: LinkTable

        private WorkbookRecordList _workbookRecordList; // TODO - would be nice to Remove this

        public LinkTable(IList inputList, int startIndex, WorkbookRecordList workbookRecordList)
        {

            _workbookRecordList = workbookRecordList;
            RecordStream rs = new RecordStream(inputList, startIndex);

            ArrayList temp = new ArrayList();
            while (rs.PeekNextClass() == typeof(SupBookRecord))
            {
                temp.Add(new ExternalBookBlock(rs));
            }

            //_externalBookBlocks = new ExternalBookBlock[temp.Count];
            _externalBookBlocks=(ExternalBookBlock[])temp.ToArray(typeof(ExternalBookBlock));
            temp.Clear();

            if (_externalBookBlocks.Length > 0)
            {
                // If any ExternalBookBlock present, there Is always 1 of ExternSheetRecord
                Record next = rs.GetNext();
                _externSheetRecord = (ExternSheetRecord)next;
            }
            else
            {
                _externSheetRecord = null;
            }

            _definedNames = new ArrayList();
            // collect zero or more DEFINEDNAMEs id=0x18
            while (rs.PeekNextClass() == typeof(NameRecord))
            {
                NameRecord nr = (NameRecord)rs.GetNext();
                _definedNames.Add(nr);
            }

            _recordCount = rs.GetCountRead();
            for(int i=startIndex;i< startIndex + _recordCount;i++)
            {
                _workbookRecordList.Records.Add(inputList[i]);
            }
            
        }
開發者ID:ChiangHanLung,項目名稱:PIC_VDS,代碼行數:44,代碼來源:LinkTable.cs


注:本文中的NPOI.HSSF.Model.RecordStream.PeekNextClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。